views:

940

answers:

2

Can you use Ninject 2.0 with VS2010 RC1?

+5  A: 

Even if it is compiled for .NET 3.5, the assembly should be able to run in .NET 4. Here's a nice picture.

Darin Dimitrov
Well it does so only when project's target framework is set to .NET 4.0. Without this I get error with message: The referenced assembly "Ninject" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
mgamer
It seems that you are using a version of Ninject that is compiled against .NET 4 in a project targeting .NET 3.5. This is not possible. Download a version of Ninject which is compiled against .NET 3.5.
Darin Dimitrov
The System.Web issue is that he is using the client profile which doesn't have the dll available. Ninject by default compiles against System.Web.dll. You can compile it with a NO_WEB option if you want.
Ian Davis
+8  A: 

I had similar issue... try targetting the full .NET 4 Framework, not the Client Profile.

From my understanding System.Web is in .NET 4, but not the .NET 4 Client Profile. So for your assemblies, in which you are taking advantage of full Ninject compiled against 3.5 sp1, you will need to ensure they are not targeting the .NET 4 Client Profile but the full .NET 4 profile in order for the dependency on System.Web to be satisfied.

StevenH
Yes. This way it works. +1
rem