Question

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?

Was it helpful?

Solution

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top