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.)
The Product version of the assembly. This is the version you would use when talking to customers or for display on your website. This version can be a string, like '1.0 Release Candidate'. The AssemblyInformationalVersion is optional. If not given, the AssemblyFileVersion is used.
You can get file version of file using PowerShell Get-Command cmdlet. In the above command, Get-Command get dll assembly file version of the specified file using FileVersionInfo. FileVersion property.
You can set the assembly version using the AssemblyVersionAttribute. Assembly attributes are usually applied in the AssemblyInfo.
I can get the Assembly Version with the following line of code: Version version = Assembly.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With