Tuesday, February 16, 2010

Indirect dependency on the framework assembly System.Web.DataVisualization

Scenario:
You are getting the following one or more such ERROR while compiling the solution

The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?

The type or namespace name 'Publishing' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?)

The type or namespace name 'ServerContext' does not exist in the namespace 'Microsoft.Office.Server' (are you missing an assembly reference?)


You are getting the following WARNING while compiling the solution

The primary reference "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".

Solution:
Actually as you have not added the binary reference for "System.Web.DataVisualization", visual studio is trying to pick the latest version from GAC. When it is not found you are getting this warning

So let's help visual studio finding this binary and that will take away this warning.

1. Right click the project and Add a reference
2. Navigate to "c:\Program Files (x86)\Microsoft Chart Controls\Assemblies\System.Web.DataVisualization.dll"

That's it

3 comments:

Anonymous,  January 3, 2012 at 7:28 AM  

Thanks it worked for me

Anonymous,  March 8, 2012 at 11:09 AM  

Thank you, you saved my time..

SamSussman February 7, 2013 at 8:35 AM  

Thanks, I am trying to figure out why. I can see the DataVisualization dll ref is missing from the .net tab... this all happened after uninstalling Oracle 11g2.