Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if asp.net 3.5 sp1 and asp.net mvc are installed in the server?

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

like image 597
Click Ok Avatar asked Jun 27 '09 16:06

Click Ok


People also ask

How do you check if .NET 3.5 sp1 is installed?

NET 3.5 is installed by looking at HKLM\Software\Microsoft\NET Framework Setup\NDP\v3. 5\Install, which is a DWORD value. If that value is present and set to 1, then that version of the Framework is installed. Look at HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.

How do I know if MVC is installed?

During design time go to “Solution Explorer." Right click on it and expand the “References” folder. Right click on “Web. MVC” Assembly. Then select “Properties” and you can find the versions.

How do I tell what version of ASP.NET is installed?

From PowerShell: Launch PowerShell as an administrator. Run the command import-module servermanager. ASP.NET 4.5: Run the command get-windowsfeature Net-Framework-45-Core. The output indicates the ASP.NET 4.5 install state ("Installed" or "Available").


1 Answers

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

like image 98
eu-ge-ne Avatar answered Oct 21 '22 06:10

eu-ge-ne