Determining the framework version under which an assembly was compiled

Here is a quick and easy way to determine the version of the framework, under which an assembly was compiled (code written using SnippetCompiler):
using System;
using System.Collections.Generic;
using System.Reflection;

public class MyClass
{
public static void Main()
{
Assembly a = Assembly.LoadFile(@"C:\PathToFile\AssemblyFile.dll");

WL(a.ImageRuntimeVersion);

RL();
}

#region Helper methods

private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}

private static void RL()
{
Console.ReadLine();
}

#endregion
}

Comments

No Comments