System.Windows.Forms.DataVisualization Namespace Fine in One Class but Not in Another

Posted by jxpx777 on Stack Overflow See other posts from Stack Overflow or by jxpx777
Published on 2009-02-20T16:34:34Z Indexed on 2010/06/16 8:22 UTC
Read the original article Hit count: 334

Filed under:
|
|
|

Hi. I'm getting this error

The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Windows.Forms' (are you missing an assembly reference?)

Here is my using section of the class:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms.DataVisualization.Charting;
using System.Windows.Forms.DataVisualization.Charting.Borders3D;
using System.Windows.Forms.DataVisualization.Charting.ChartTypes;
using System.Windows.Forms.DataVisualization.Charting.Data;
using System.Windows.Forms.DataVisualization.Charting.Formulas;
using System.Windows.Forms.DataVisualization.Charting.Utilities;

namespace myNamespace {
    public class myClass {
        // Usual class stuff
    }
}

The thing is that I am using the same DataVisualization includes in another class. The only thing that I can think that is different is that the classes that are giving this missing namespace error are Solution Items rather than specific to a project. The projects reference them by link. Anyone have thoughts on what the problem is? I've installed the chart component, .Net 3.5 SP1, and the Chart Add-in for Visual Studio 2008.

UPDATE: I moved the items from Solution Items to be regular members of my project and I'm still seeing the same behavior.

UPDATE 2: Removing the items from the Solution Items and placing them under my project worked. Another project was still referencing the files which is why I didn't think it worked previously. I'm still curious, though, why I couldn't use the namespace when the classes were Solution Items but moving them underneath a project (with no modifications, mind you) instantly made them recognizable. :\

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET