如何知道服务器中是否安装了asp.net 3.5 sp1和asp.net mvc?

时间:2022-12-04 18:22:19

When I use:

我用的时候:

System.Environment.Version

The result is "2.0.50727.3053"

结果是“2.0.50727.3053”

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

我知道3.5是兼容的,在IIS中被识别为2.0,等等......

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.

我想知道安装的确切.net版本以及是否安装了其他资源,如ASP.NET MVC等。问题是该网站安装在共享主机中,所以我可以询问有关技术支持的资源,但如果我以编程方式知道,它会好得多。

Regards

问候

3 个解决方案

#1


7  

Not sure but try something like this:

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

bool mvcInstalled = true;

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

UPDATED:

更新:

To know if .NET 3.5 SP1 is installed check for System.Web.Abstractions assembly

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

#2


2  

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

ASP.NET MVC未内置于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.

我想澄清一下我在网络上看到的关于ASP.NET MVC和.NET Framework 3.5 Service Pack 1的一些混乱.ASP.NET MVC并未作为SP1的一部分发布。我再说一遍,ASP.NET 3.5 SP1不包括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.

SP1发布的是ASP.NET路由功能,ASP.NET MVC和动态数据都在使用它。

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

所以你有它,从马的嘴里(再次被哈克)。

#3


1  

The problem you have is that you are mixing up the compiler/run time version with the framework versions.

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

Running System.Environment.Version will get you 2.0 - which is true - but that is not what you are looking for.

运行System.Environment.Version将获得2.0 - 这是真的 - 但这不是你想要的。

Are you looking for a one time answer or something to be used over and over? If you truly want to know - upload a sample MVC app and see if it runs. Otherwise you are going to have to programmatically inspect what is installed on the machine you are running on.

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

#1


7  

Not sure but try something like this:

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

bool mvcInstalled = true;

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

UPDATED:

更新:

To know if .NET 3.5 SP1 is installed check for System.Web.Abstractions assembly

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

#2


2  

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

ASP.NET MVC未内置于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.

我想澄清一下我在网络上看到的关于ASP.NET MVC和.NET Framework 3.5 Service Pack 1的一些混乱.ASP.NET MVC并未作为SP1的一部分发布。我再说一遍,ASP.NET 3.5 SP1不包括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.

SP1发布的是ASP.NET路由功能,ASP.NET MVC和动态数据都在使用它。

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

所以你有它,从马的嘴里(再次被哈克)。

#3


1  

The problem you have is that you are mixing up the compiler/run time version with the framework versions.

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

Running System.Environment.Version will get you 2.0 - which is true - but that is not what you are looking for.

运行System.Environment.Version将获得2.0 - 这是真的 - 但这不是你想要的。

Are you looking for a one time answer or something to be used over and over? If you truly want to know - upload a sample MVC app and see if it runs. Otherwise you are going to have to programmatically inspect what is installed on the machine you are running on.

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