Skip to content

Instantly share code, notes, and snippets.

@jakesays-old
Created September 6, 2014 18:43
Show Gist options
  • Save jakesays-old/9107987b882a3a3933e2 to your computer and use it in GitHub Desktop.
Save jakesays-old/9107987b882a3a3933e2 to your computer and use it in GitHub Desktop.
Using IKVM.Reflection to obtain an assembly's version
private static string GetVersionFromAssembly(byte[] fileData, string fileName)
{
var reflector = new Universe();
AssemblyName name = null;
using (var fileStream = new MemoryStream(fileData))
{
var module = reflector.OpenRawModule(fileStream, fileName);
if (module == null)
{
return null;
}
name = module.GetAssemblyName();
if (name == null)
{
return null;
}
}
var version = name.Version.ToString();
return version;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment