dllvisual-studio-2010assembliesversion

Assembly version from command line?


Is there a Microsoft tool to get the assembly version of a DLL file from a command line?

(I know that I can code my own tool.)


Solution

  • This is an area where PowerShell shines. If you don't already have it, install it. It's preinstalled with Windows 7.

    Running this command line:

    [System.Reflection.Assembly]::LoadFrom("C:\full\path\to\YourDllName.dll").GetName().Version
    

    outputs this:

    Major  Minor  Build  Revision
    -----  -----  -----  --------
    3      0      8      0
    

    Note that LoadFrom returns an assembly object, so you can do pretty much anything you like. No need to write a program.