vendredi 1 décembre 2017

Determine assembly framework without loading it

I'm writing a C# console application which must run under .NET Framework 2.0, but needs to be able to identify an assembly's framework version, even if it's higher than .NET 2.0.

I can't use AssemblyName.GetAssemblyName or related functions because they will throw a BadImageFormatException if the target assembly was built under a later framework version. Is there some way to get this information without attempting to load the assembly in any way?

Note: I know that this is possible using PowerShell, but that tool is not available in the target environment.





Aucun commentaire:

Enregistrer un commentaire