Wednesday, 29 October 2008

Extension Method Issues with Ninject

I thought I'd put this up here quickly as, hopefully, it may be of use to others who've come across and struggled with the extension method issue with Ninject. I've got another post on Ninject and Moq mock injection coming up soon.

If you've used Ninject in your .NET 3.5 projects you may have had occasional problems compiling your solution. If the compiler throws the "Missing compiler required member 'System.Runtime.CompilerServices.ExtensionAttribute..ctor'" error, you've encountered an issue with the Ninject.Core.dll v1.0.0.82 which is currently available from

The issue is discussed here but the solution to the problem isn't very clear. Though, if you read very carefully you'll find that you're encouraged to download the source and re-build Ninject yourself after adding a NET_35 pre-processor directive.

As it turns out, Nate Kohari - father of Ninject - has fixed the issue and published the Ninject SVN trunk on the web. So all you need to do is point your SVN client (I use Tortoise) to, pull out the code, and build yourself a release version of the DLLs.

Problem solved!


Jeff Gonzalez said...

Just saved me! Thanks... I was getting this error - didn't know it was related to Ninject. Rebuilt, Viola!

Thanks again -


Mads Nissen said...

Absolutt spart meg for minst 10 nye minutter før jeg ellers ville sjekket ut trunken:)


Nym said...

Haha your a star :D

Shane said...

Thank you very much! Saved me some time.