Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 373
Patrice Pezillier Avatar asked Jun 14 '10 12:06

Patrice Pezillier


People also ask

What is assembly version?

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.

How do I find the PowerShell assembly version?

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.

Where do I put assembly version?

You can set the assembly version using the AssemblyVersionAttribute. Assembly attributes are usually applied in the AssemblyInfo.

How can you get the assembly version in C #?

I can get the Assembly Version with the following line of code: Version version = Assembly.


1 Answers

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.

like image 193
OregonGhost Avatar answered Sep 23 '22 19:09

OregonGhost