Results 1 to 4 of 4

Thread: [RESOLVED] Determine an external EXE/DLL target .NET version

  1. #1

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Resolved [RESOLVED] Determine an external EXE/DLL target .NET version

    Is there any way (via code or otherwise) that you can tell what version of the .NET framework a particular EXE or DLL is targetting? I know the long way round would be to try and run it on a machine with just .NET 1.1 on, then if that doesnt work try it on a machine with 2.0 on, etc etc but just wondering if there is an easier way

    Cheers
    Chris
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  2. #2
    Hyperactive Member BadgerBadger's Avatar
    Join Date
    Aug 2009
    Location
    Wales
    Posts
    382

    Re: Determine an external EXE/DLL target .NET version

    Code:
    http://msdn.microsoft.com/en-us/library/system.reflection.assembly.imageruntimeversion.aspx
    That any help?
    "The only thing that interferes with my learning is my education."

  3. #3
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: Determine an external EXE/DLL target .NET version

    You can get it with Reflection
    vb Code:
    1. Imports System.Reflection
    2.  
    3. Namespace Reflection
    4.     Public Class Peeker
    5.         Public Function GetTargetFramework(ByVal Path As String) As String
    6.             Dim asm As Assembly = Assembly.LoadFile(Path)
    7.             Return asm.ImageRuntimeVersion
    8.         End Function
    9.     End Class
    10. End Namespace
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  4. #4

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Determine an external EXE/DLL target .NET version

    Ah I see, thanks both of you
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


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