I have a C# project which includes a dataset.xsd. I have placed an instance of the dataset on the form design view. The designer code which allocates the instance always qualifies the dataset type name with the namespace, which causes a compile failure as the form's InitialiseComponents is in the same namespace - it looks for a nested name.
I can get a clean build by removing the namespace qualification from the assignment
obj = new NAMESPACE.class;
but of course it is re-generated anytime the design view is edited.
What is the fix
Regards

Unnecessary Namespace in Designer code
Heiko Wilkens
Yes - all fixed, so simple!
My form had the same name as the namespace.
Thanks
John
FrankaFarrerajr
Can you post the namespace name of your form, the data set name, the namespace which contains your dataset, the namespace which contains your form, and the line of code (like above), but with the actual names of the types, and the build error that you're seeing :)
The way to fix this would in code generation scenarios, when you don't control the source of the code generator, is to rename the code element that is causing the conflict. It's hard to tell from the example you gave above exactly where that conflict is coming from. It should be fine if the dataset and the form are in the same name. It would be a problem if the name of the namespace in which your dataset resides and the name of your form are the same. If that's the case, I would suggest either renaming your namespace or your form.
That is, it may be that your code looks something like:
namespace
Test{
class DataSet1 { }
}
namespace
Test{
class Test
{
void InitializeComponent()
{
Test.DataSet1 dataSet1 = new Test.DataSet1();
}
}
}
In this case, changing the name of the form from Test to something else would fix the problem.
Hope that helps!
Anson Horton
C# IDE PM