Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am receiving the following error when I try to build a project.

VB
Type 'DataVisualization.Charting.Chart' is not defined.


Thank you in advance for your help.
Posted
Comments
Sergey Alexandrovich Kryukov 14-May-12 14:41pm    
Which DataVisualization.Charting? Could be System.Windows.Forms.DataVisualization.Charting, System.Web.UI.DataVisualization.Charting...
--SA
Acme Softech 21-Feb-23 7:02am    
I am having the same issue but only while publishing the app. At build time it is fine. Help please.

When you get that error during the compile, you also get information on which line the error occurred at which module.

Now double click the error and Visual Studio should take you exactly to the line causing the error.

Regarding the error itself, you're trying to use a library which most likely isn't referenced in your project. See: http://msdn.microsoft.com/en-us/library/wkze6zky.aspx[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-May-12 14:44pm    
I would think that, too, please see my comment to the question and my answer.
My 5.
--SA
Wendelius 14-May-12 14:49pm    
Yes, a good question!
Monjurul Habib 17-May-12 16:21pm    
perfect, 5+
OsoJames 5-Apr-13 6:10am    
Thank you, best answer
It looks like you do not have sufficient rights to load this assembly. You need to install the chart control using the MSChart.exe on that box. I'm not sure if it is possible in your hosted environment.

Is the type System.Web.UI.DataVisualization.Charting.Chart picked up from the GAC? It sometimes fails to load some assemblies from the GAC sometimes. Please add the corresponding dll in your bin directory directly and try running your app and see if that works out for you.

The problem might be due to the fact that you are referencing the type in your view and not in your controller, in that case you probably need to define the assembly info as a web.config setting or as a page directive.

XML
<assemblies>
        <add assembly="System.Web.UI.DataVisualization.Charting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=<YourPublicKeyToken>(31bf3856ad364e35)"/>
</assemblies>


REF:
Chart Error
Could not load file or assembly ‘System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′ or one of its dependencies
System.Web.UI.DataVisualization.Charting missing error in .net 4.0?
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-May-12 14:43pm    
How do you know if OP referenced the assembly at all? Also, how do you know that is System.Web.UI.DataVisualization.Charting? There are others -- please see my comment to the question and my answer.
--SA
Monjurul Habib 14-May-12 23:55pm    
yes , i agree. i didn't notice carefully :P. but where is your answer?
Sergey Alexandrovich Kryukov 17-May-12 16:16pm    
This is already on one answer, the one by Mika.
--SA
Monjurul Habib 17-May-12 16:21pm    
yes it is :)
I fixed it by doing the following:
(added F sarp .NET project library), then right click "Add reference" and in "Assemblies" I searched for "System" and there I found the right box - "System.Windows.Forms.DataVisualization.Charting"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900