I downloaded the latest Mono.Cecil and now whenever I start up my project it gives me that error. It goes away if I remove and add mono.cecil. But that is a pain to do every
I am also facing the same problem. The error System.Runtime.CompilerServices.ExtensionAttribute..ctor
I'm using Newtonsoft.Json.Net dll(reference) in my project. I removed the reference to the file Newtonsoft.Json.Net20.dll, and the re-added it. After this my solution builds again.
Strange but true...my application builds successfully.
Error when using extension methods in C#
Thanks,
I fixed this error by removing the reference to "Mono.Cecil.dl" and "Mono.Reflection.dll" from my project.
These two files come with db4o v8.0 (an object database) and don't appear to be needed for db4o to operate in its basic, non-optimized mode under Windows 7 x64 + .NET 4.0.
This issue is a well know problem for all .NET 2.0 Projects that want to use Extension Methods internally and therefore declare their own internal System.Runtime.CompilerServices.ExtensionAttribute
to allow this.
There are various ways around this problem, if you're using .NET 3.5 or higher, simply compile Mono.Cecil with NET_3_5
or NET_4_0
defined. If you're targeting .NET 2 you might be lucky and get it to compile (it depends on some compiler internals, definitely not the csc commandline or MSBuild) out of the box. If not, the workaround would be stripping all occurences of that Attribute (including the definition) from the 2.0 Cecil assembly (using Cecil itself...).
I have already done this and it's not a big deal. However I feel your issue is a different one, so please provide a little more detail on the Mono Version and .NET version you're using/targeting.