Assembly version from command line?
If you use mono and linux, try this:
monodis --assembly MyAssembly.dll
find . -name MyAssembly.dll -exec monodis --assembly {} ';' | grep Version
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.
For those, like I, who come looking for such a tool:
using System;
using System.IO;
using System.Reflection;
class Program
{
public static void Main(string[] args)
{
foreach (string arg in args)
{
try
{
string path = Path.GetFullPath(arg);
var assembly = Assembly.LoadFile(path);
Console.Out.WriteLine(assembly.GetName().FullName);
}
catch (Exception exception)
{
Console.Out.WriteLine(string.Format("{0}: {1}", arg, exception.Message));
}
}
}
}
In Powershell
$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("filepath.exe").FileVersion.ToString()