10

When I use:

System.Environment.Version

The result is "2.0.50727.3053"

I know that 3.5 is compatible and in IIS is identified as 2.0, blah blah...

I would like to know the exact .net version installed and if another resources are installed, like ASP.NET MVC, etc. The problem is that the website is installed in a shared hosting, so I can ask about that resouces to tech support, but if I know programatically, its far better.

Regards

4

3 回答 3

7

不确定,但尝试这样的事情:

bool mvcInstalled = true;

try
{
    System.Reflection.Assembly.ReflectionOnlyLoad(
        "System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35");
}
catch()
{
    mvcInstalled = false;
}

更新:

要了解是否安装了 .NET 3.5 SP1,请检查 System.Web.Abstractions 程序集

于 2009-06-27T17:01:00.200 回答
2

ASP.NET MVC is not built into Microsoft .NET framework 3.5 SP1.

See this post

I wanted to clear up a bit of confusion I’ve seen around the web about ASP.NET MVC and the .NET Framework 3.5 Service Pack 1. ASP.NET MVC was not released as part of SP1. I repeat, ASP.NET 3.5 SP1 does not include ASP.NET MVC.

What was released with SP1 was the ASP.NET Routing feature, which is in use by both ASP.NET MVC and Dynamic Data.

So there you have it, from the horse's mouth (Haacked again ;).

于 2009-06-27T16:31:49.413 回答
1

您遇到的问题是您将编译器/运行时版本与框架版本混合在一起。

运行 System.Environment.Version 将为您提供 2.0 - 这是真的 - 但这不是您想要的。

您是在寻找一次性答案还是要反复使用的东西?如果你真的想知道 - 上传一个示例 MVC 应用程序并查看它是否运行。否则,您将不得不以编程方式检查您正在运行的机器上安装的内容。

于 2009-06-27T16:49:42.663 回答