Reflect specific framework version?
Using Mono.Cecil
if (MethodDefinition.ReturnType == AssemblyDefinition.MainModule.Import(typeof(string)))
Is failing because the assembly I reading is .net 2 but my program is .net 4. So it is tryi开发者_运维技巧ng to compare string v2 and string v4 so it will never be equal. How can I get the string from v2 without building my program with .net 2?
Your question is similar to this one
In short, you should be able to get the string
type with this :
AssemblyDefinition.MainModule.TypeSystem.String
精彩评论