CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2001
    Location
    Slovakia, Europe
    Posts
    58

    Question read .NET Framework version in PE file header

    Hi all!

    As it is written here: http://msdn.microsoft.com/library/de...dexsidenet.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.

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    you mean you want to know the .NET framework version using C# program ! right !
    try,
    Environment.Version

    Paresh
    - Software Architect

  3. #3
    Join Date
    Sep 2001
    Location
    Slovakia, Europe
    Posts
    58

    nearly this one

    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.

  4. #4
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    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
    - Software Architect

  5. #5
    Join Date
    Sep 2001
    Location
    Slovakia, Europe
    Posts
    58

    Frramework version

    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.

  6. #6
    Join Date
    Jul 2002
    Location
    .NET 2.0/.NET 3.0/.NET 3.5 VS2005/VS2008
    Posts
    284
    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
    WM.

    What about weapons of mass construction?

  7. #7
    Join Date
    Sep 2001
    Location
    Slovakia, Europe
    Posts
    58

    Outer application

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured