.Net versionAuthor: Dave Date: 05.05.15 - 2:59pm If you have a .Net binary and want to know what version of the framework it targets from native code the following may help. it may however have an issue The function has also been depreceated by MS but still included it appears. below is for VB6. '[DllImport("mscoree.dll", CharSet = CharSet.Unicode)] 'private static extern int GetFileVersion ' (string path, StringBuilder buffer, int buflen, out int written); Private Declare Function GetFileVersion Lib "mscoree.dll" ( _ ByVal path As Long, _ ByVal buf As String, _ bufLen As Long, _ ByRef cb As Long _ ) As Long ok actually in a little more testing..I dont think this function is returning what I really want. Observe the following screen shots, for this binary, the api above is returning the 2.0xxx value for the runtime version of the native dlls, but in the config it was specified to use .net 3.5. In the second screen shot, you can see the .net 4.0 was loaded. I want the target framework, not the runtime version, so I guess I would have to parse the CLR assembly metadata tables yuk! The runtime version does not change even if you compile the target framework as 2.0. Click on the images to enlarge. Comments: (0) |
About Me More Blogs Main Site
|
|||||||||||||||||||||||||||||||