Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to find AssemblyFactory class using Mono.Cecil

Tags:

mono.cecil

I am using the Mono.Cecil DLL file and writing this code:

AssemblyDefinition sourceAssembly = AssemblyFactory.GetAssembly(assemblyPath);

My project is not getting compiled, because it is not able to find the class "AssemblyFactory". As if this class is not present in the DLL file at all. I have added the mono.cecil.dll file as a reference to my project. Is this class present somewhere outside the DLL file, maybe in some other DLL file at the .NET level?

like image 564
samar Avatar asked Nov 11 '11 05:11

samar


1 Answers

This simply means that you're using an up to date version of Mono.Cecil where this deprecated type has been removed.

Please have a look at the migration page on Cecil's wiki to know how to convert code for Cecil 0.9. You'll see that you just have to change this line to read:

var assembly = AssemblyDefinition.ReadAssembly(assemblyPath);
like image 97
Jb Evain Avatar answered Jan 04 '23 12:01

Jb Evain