One possible exception you may have encountered immediately is the following:
"'Legend' is ambiguous in the namespace 'System.Web.UI.DataVisualization.Charting'."
This all points to the need to update the references to the 18.104.22.168 version of the System.Web.DataVisualization.dll used by the MS Chart controls. The following steps need to be completed to get your project current and working with the 4.0 version of the Chart controls.
1. Remove the reference to the System.Web.DataVisualization .dll in the project. If just converted it will still be referencing the 22.214.171.124 version of the .dll.
2. Add a reference to the new 126.96.36.199 version of the .dll from the '.NET' tab when adding a reference to your project. You can view the 'Version' column to make sure you have the correct reference.
3. In the web.config, update the version number in the 'Controls' tag from 188.8.131.52 to 184.108.40.206. Nothing else needs to be modified; the PublicKeyToken, etc. are all the same. Just change the version number. The corrected configuration is displayed below:
4. In the web.config, update the version number in the 'assembly' tag for the System.Web.DataVisualization reference from 220.127.116.11 to 18.104.22.168 if not already done. This may have been updated when adding the reference in Step #2, but if not go ahead and modify it now. The corrected configuration is displayed below:
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
5. In the web.config, update the 'httpHandlers' section for "ChartImg.axd" version once again from 126.96.36.199 to 188.8.131.52. The corrected configuration is displayed below:
<add assembly="System.Web.DataVisualization, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
6. In the markup of any page using the Chart controls, remove the page registration for the assembly; just delete it. The next step will add back in the proper registration.
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
7. From the 'ToolBox' under the 'Data' tab, drag a 'Chart' control onto your existing page. This simple method will create the proper registration at the top of the page. Make sure to modify the 'TagPrefix' to the proper value if you had changed it previously from the default 'asp' used. After the registration is added back to the page, you can delete the chart control dragged on the page; it was just used to create the proper registration (this happens whenever a new control is dragged onto a page). Repeat this step for any pages that have a chart control on them. The proper page registration is shown below:
8. Rebuild your solution and run it. Your MS Chart controls should now be displayed properly!
<%@ Register Assembly="System.Web.DataVisualization, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
As an additional reference, the MS Chart samples for .NET have been updated for the .NET Framework 4.0. If you have any additional problems, download the samples project and view the code or markup. You can find the samples at the following link:
Samples Environment for .NET Framework 4 Chart Controls Released!
Thank you, this was helpful just upgraded my project from vs 2008 to vs 2010 and was suddenly getting errors.ReplyDelete
Helped me, thanks. Search your project (use F3 key) for "3.5", you will find any references you've missed!ReplyDelete
Thank you for this steps to be followed. But i was stuck up with the same error after doing all these.
BC30560: 'Chart' is ambiguous in the namespace 'System.Web.UI.DataVisualization.Charting'.
I added the dll into the application's bin folder, then got my application worked.
Really appreciate this post. I also had to copy the DLL to my application's bin folder. Thanks.ReplyDelete
what DLL file should copy into project bin folder? Please help.ReplyDelete