views:

1313

answers:

1

I am trying to run a .NET 4.0 Console application that references a sister library project (Bar.dll) which itself references System.Web.Extensions in VS2010 B2. I am currently only interested in getting access to System.Web.Scripting.JavaScriptSerializer.

Both projects have references to System.Web.Extensions (using the one listed under ".NET" in the App References dialog), but when I try to compile/run the application, the compiler barks:

C:\Windows\Microsoft.NET\Framework\v4.0.21006\Microsoft.Common.targets(1291,9):
warning MSB3253: The referenced assembly "Bar.dll" could not be resolved because it has a dependency on 
"System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client".

Seriously? What's going on? Why won't the compiler link with the assembly?

+4  A: 
currently targeted framework ".NETFramework,Version=v4.0,Profile=Client".
                                                         ^^^^^^^^^^^^^^

You're targeting the Client Profile, which doesn't include the Web assemblies. Go into Project > Properties > Application and change Target Framework to ".NET Framework 4".

itowlson
Huh. You're absolutely right. I guess I better learn about these profile things. I can't believe they changes the linker rules like this. Any good links out there?
Frank Krueger
http://windowsclient.net/wpf/wpf35/wpf-35sp1-start-here.aspx is a good starting point for the Client Profile in general. http://blogs.msdn.com/bclteam/archive/2008/05/21/net-framework-client-profile-justin-van-patten.aspx is a bit out of date (it refers to the 3.5 SP1 beta) but should still help give a clear idea of what's in and what's not.
itowlson