Friday, June 25, 2010

Resolving "reference could not be resolved because it has an indirect dependency on the framework assembly" issue while migrating to VS 2010

We suffered an migration issue when migrating Visual Studio 2008 to Visual Studio 2010. Below is the Error.

The primary reference "....dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "C...dll" or retarget your application to a framework version which contains "System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Its an confusing error and google/MSDN search doesnt help either.

But we had an work around just add

1. System.web.Extensions.dll (V3.5) to your project
2. Mark the file as "Copy to Output Directory"
3. Build now and it works.











Based on the behaviour we can refer that its actually looking for the 3.5 version of System.Web.Extensions which doesnt exist in GAC. If there is an direct approach for this please comment.

fullmeals dev team

No comments: