Geeks With Blogs
Gary Pronych 1 Part .NET Developer, 2 Parts Personal Developer; 100% Canadian
I needed to find the version of .NET framework required for a vendor provided application in short order; there was no documentation (of course), the vendor was not available and the super user was not available.
Your typical support scenario.

When you try to run a .NET EXE on a computer that does not have the framework, your application informs you with a prompt along the lines of 'The Application Requires .NET framework version x.x'
If you have the framework installed, it does not prompt you (of course).

I figured it should be as easy as right clicking the EXE and selecting properties or something similar, but no.
The easiest way I found was by using the MSIL Disassembler ildasm.exe
If you have installed the 2.0 SDK you can find ILDASM.exe in this location

c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ildasm.exe

The steps to get the .NET framework version are as follows:
1) Execute ILDASM.EXE from the SDK folder noted above
2) In ILDASM select the File | Open menu
3) Select the EXE or DLL you want to disassemble

ILDASM will now show you the file you selected in #3. You will want to double click the MANIFEST and it will load the manifest in a notepad-like editor.
The top line will read //Medata version: vX.X.XXXX
Where the X.X.XXXX is your .NET framework version.

See the image below

ILDASM.exe Posted on Wednesday, August 27, 2008 3:39 AM .NET , Tools | Back to top


Comments on this post: Determine .NET Framework Version of an Application

# re: Determine .NET Framework Version of an Application
Requesting Gravatar...
I was searching for how to determine .net framework version needed for given application. Here I got very valuable information.
I need to know more about. Yeas there are versions of each and every assemblies using the application, I need to know how this really happens in the runtime. We know .Net application runs as JIT debugging. Is there ant possibility too run some application which use .Net framework 3.0 assemblies (Let say: But at some given running cycle it won't use those) on only .Net framework 2.0 installed environment.
Please Help me to clarify this.

Regards,
Manoj

Left by Manoj Gamage on Oct 06, 2008 10:54 PM

# re: Determine .NET Framework Version of an Application
Requesting Gravatar...
I have a similar problem but it is for older versions of the framework; 2.0 DLL's will not work with 1.1 applications.

For your problem, it sounds like your can using the Multi-targeting feature in VS 2008.
I would suggest targetting the 2.0 framework in your VS 2008 project (for your 3.0 DLLs).
You can write your application with 3.x features, but the compiled code will target the framework specified.

ScottGu talks about it here
http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx

Hope this helps,
Gary
Left by Gary Pronych on Oct 07, 2008 8:00 AM

# re: Determine .NET Framework Version of an Application
Requesting Gravatar...
I set everything to ToolsVersion=3.5 and I still see the same metadata version as if it were set to 2.0. Any insight into that?
Left by John Baughman on Oct 08, 2008 2:53 PM

# re: Determine .NET Framework Version of an Application
Requesting Gravatar...
Maybe I should clarify a bit...

I have a command line build process that I set all the project files' Project tags ToolsVersion attribute to use 3.5 and it still shows the metadata version as 2.0.
Left by John Baughman on Oct 08, 2008 3:01 PM

# re: Determine .NET Framework Version of an Application
Requesting Gravatar...
I think I figured it out.

This post helped a little: http://www.eggheadcafe.com/software/aspnet/31269155/how-to-determine-what-ver.aspx

What I determined was looking at my DLL it shows the metadata version: // Metadata version: v2.0.50727

And then later in the manifest, I see:
.assembly extern System.Web.Extensions
{
.publickeytoken = (31 BF 38 56 AD 36 4E 35 ) // 1.8V.6N5
.ver 3:5:0:0
}
Which tells me this DLL needs 3.5.
Left by John Baughman on Oct 09, 2008 11:45 AM

# re: Determine .NET Framework Version of an Application
Requesting Gravatar...
I did this, it worked great. The Ildasm.exe was in a different place. But when i tried to download 2.0.50727 like it said the downloader said it was already installed and the program still refuses to open. Any ideas?
Left by Austin on Jul 26, 2011 8:33 PM

# re: Determine .NET Framework Version of an Application
Requesting Gravatar...
Well, I've got a file here that says:
// Metadata version: v4.0.30319

But further down in the manifest it says:
[mscorlib]System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(string) = ..).NETFramework,Version=v4.5,Profile=Client..T..FrameworkDisplayName!.NET Framework 4.5 Client Profile

Maybe the metadata version isn't always the same as the .net version required?
Left by Catherine on Sep 16, 2011 2:10 AM

Your comment:
 (will show your gravatar)


Copyright © Gary Pronych | Powered by: GeeksWithBlogs.net