Assembly version from command line?

后端 未结 9 1488
慢半拍i
慢半拍i 2020-12-12 21:35

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.)

相关标签:
9条回答
  • 2020-12-12 22:26

    I used the selected answer until I got the following error Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. for several assemblies

    using

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

    should work in those cases (probably all cases)

    0 讨论(0)
  • 2020-12-12 22:27

    Adding some sugar to the other powershell-ish answers...

    To get extended properties like 'FullName'

    $dllPath = "C:\full\path\to\YourDllName.dll";
    $ass  = [System.Reflection.Assembly]::LoadFrom($dllPath);
    $ass.GetName();
    $ass
    
    0 讨论(0)
  • 2020-12-12 22:29

    File Version tool will help:

    filever /V YourDllName.dll
    
    0 讨论(0)
提交回复
热议问题