Click to See Complete Forum and Search --> : read .NET Framework version in PE file header


malinrob
April 9th, 2003, 06:56 AM
Hi all!

As it is written here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/sidexsidenet.asp
, in the header of a PE file, there it is written the .NET Framework version, the application was built by.
How could I read out this .NET Framework version info using C#?

Thx a lot.

pareshgh
April 9th, 2003, 04:51 PM
you mean you want to know the .NET framework version using C# program ! right !
try,
Environment.Version

Paresh

malinrob
April 10th, 2003, 10:36 AM
What I exactly need is following:
There is a PE file(exe or dll). I want to read the version of .NET Framework(the version which was used during the building of this PE file) from the header of this file by a C# program.

Thx.

pareshgh
April 10th, 2003, 12:14 PM
for example,

Assembly ab = Assembly.LoadFrom("exe or dll file");
ab.GetName().Version.Minor

Version has all.
and GetName(). you can get culture info etc... all the information.

Paresh

malinrob
May 6th, 2003, 06:18 AM
This is still not what I really need.

I have a file WinApp.exe. I need to detect what version of .NET FRamework was this file created by (1.0.3705 or 1.1.4322...). I would need to detect it by a C# program.

Any help would be great.
Thx.

WillemM
May 6th, 2003, 06:34 AM
Did you build that application yourself ?
If so: If you build it using visual studio .net 2002 it's one of the 1.0 network versions (SP1 or SP2). If you build it with visual studio .net 2003 it's 1.1

I guess paresh is right with Environment.Version

malinrob
May 7th, 2003, 04:24 AM
No I meant an app.exe file built not by me. So I only know that it is an .NET assembly, but I do not know what Framework version was used to build it and I would need to detect it.
Any ideas?
Thx a lot.