[Solved] Ninject ‘System.Runtime.CompilerServices.ExtensionAttribute’ is defined in multiple assemblies

Ninject Bug with .net framework 3.5

If you getting this error with your application that using ninject dependency injector.

System.Runtime.CompilerServices.ExtensionAttribute’ is defined in multiple assemblies in the global alias; using definition from  [….]\Ninject.Core.dll
Missing compiler required member ‘System.Runtime.CompilerServices.ExtensionAttribute..ctor’

This is a know bug with ninject.NET 2.0 build would work for .NET 3.5 as well, but the extension method patch will screw things up.

Solution is:

 You can solve it by yourself

1)  Download source , extrat it some folder and open with VS IDE.

2) There are two project   “Core” and “Tests” that we change .

3) Open project properties windows by click solution explorer-> Core (Right Click ) -> Properties

4)Click “Application” Tab on the left side

5) Select  “.NET 3.5 framework ” in Target Framework combobox. 

6) Click  “Build” Tab on the left side

7)  type “NET_35” in Conditional Compilation Symbol box (Preprocessor flag)

8) Do it same with “Tests” Project

9) Rebuild solution.

Its worked for me 🙂

About bpostaci
Escalation Engineer in Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: