Scott Hanselman

Output an Assembly Version/Fully Qualified Name from the CommandLine

September 10, 2004 Comment on this post [0] Posted in Nant
Sponsored By

In the vein of incredibly easy 1 or 2-lines of code, here's another that's too embarassingly easy program to mention considering I asked for help to write it! :)  It IS useful I think though. (Unless there was something included with the Framework that I missed!)

public class AssemblyVersion
{
    public static void Main(string[] args)
    {
        Assembly asm = Assembly.LoadFrom(args[0]);
        Console.WriteLine(asm.FullName.ToString());
    }
}

This will print out the assembly qualified name of any .NET assembly ala:

c:\>assemblyversion.exe clipboard.exe
clipboard, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null

This can be useful for auditing and creating manifests/lists of assemblies that are included with a distribution.  We'll probably put it in a NAnt task to make a list of what's supposed to be there versus what IS there.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.