Get the current clean version of my application

How to get the current clean version of my asp.net application.

I tried the solution here

Is there an easy way to check the version of the .NET Framework?

It installs the highest version, but I need a working version.

+4
source share
3 answers

Use Environment.Version to get the runtime version. It will provide the .Net CLR version number that is used to run the current application.

You need to be careful here, this will only result in a version return without a framework version. The CLR for .NET 3.0 and .NET 3.5 is the same CLR from .NET 2.0.

+6
source

Use Environment.Version - it gives the exact version of .NET that launches the application.

+4
source

Hope this helps,

 DirectoryEntry site = new DirectoryEntry(@"IIS://localhost/w3svc/1/Root"); PropertyValueCollection values = site.Properties["ScriptMaps"]; foreach (string val in values) { if (val.StartsWith(".aspx")) { string version = val.Substring(val.IndexOf("Framework") + 10, 9); MessageBox.Show(String.Format("ASP.Net Version is {0}", version)); } } 

The map script property is an array of strings. If the application supports asp.net, one of these lines will display the aspx file extension for the asp.net handler, which will be the full path to the DLL. The path will look like

% Windir% / Microsoft.NET / Framework // aspnet_isapi.dll.

You can get the version from this line using simple parsing.

-3
source

Source: https://habr.com/ru/post/1386497/


All Articles