Question

I moved a typed dataset from one project to an ASP Web Application project. I put the typed dataset into one of the existing directories as it was in the App_Code directory of the previous site but don't see the option to create that asp.net folder in this project.

Now, when I try to instantiate the typed dataset, the compiler says 'The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)'.

Thoughts?

Was it helpful?

Solution

You may need to re-gen the DataSet. When you move the .xsd, you've only moved the xml layout of the DataSet.

Delete any generated code file, open the xsd, move something, and then save it. The save operation calls the generator. Or you can right-click on the .xsd file and call the generator directly.

OTHER TIPS

Make sure the compiler knows it's a dataset and not just an Xml file. Select the DataSet.xsd in Solution Explorer, then in the Project window ensure that "Custom Tool" is set to MSDataSetGenerator.

After that, instead of guessing, open up the dll file in Reflector and look for your DataSet class. Make sure it's in the namespace you think it is.

I moved my web site to a Web Application Project and experienced the same issues. I took the approach mentioned in the first answer and was able to get the project to compile eventually. I would like to add a little more detail to the first answer.

To be explicit: I first deleted all of the files associated with the xsd file except for the xsd file itself (the xss, xsc, cs, ...). I then right-clicked on the xsd file, selecting "View Designer" and then "View Code", and then "Run Custom Tool". All of the files were re-gened and the references compiled.

In Visual Studio 2015, what I did was

  1. Before I right-click the added dataset to Include in project, I deleted the .xss and .xsc files and left the rest.

  2. I then right-click the .xsd file and included in the project and problem solved.

Hope I solved someone's problem.

You have included the "using namespace" statement in the new code?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top