-1

So I've seen similar questions asked regarding this but none of the answers ever solved my issue. So I'm going to ask for myself.

I have a web application written in C# with VS2010. The website runs perfect uncompiled. When I attempt to build the application, I get a lot of errors like: "The type or namespace name 'XXXXTableAdapter' could not be found (are you missing a using directive or an assembly reference?"

The pages are coded as: 'using XXXXTableAdapter;' which always shows an error in the intellisense.

The dataset XSD files have the Build Actions set to 'None' with the custom tool 'MSDataSetGenerator'. The file 'XXXXTableAdapter.Designer.cs' starts with 'namespace '{APP}.App_Code {' I read that you should be able to prefix the using XXXXTableAdapter; like using {APP}.App_Code.XXXXTableAdapter but I can never get this to work. I think I'm missing some code somewhere so I can access the tableadapters from any page using the application namespace.

Any ideas?

PigsIncorporated
  • 143
  • 4
  • 18
  • Does it have any Third party DLL references?. Do check for those DLL's in the reference of the project file. – Karthik Aug 03 '15 at 12:06
  • I fixed this issue by moving the XSD files out of the App_Code folder and into a new folder called "Database". Then referencing the TableAdapters with {APP}.Database.XXXXTableAdapter worked. – PigsIncorporated Aug 22 '15 at 10:51

2 Answers2

1

To change/adjust/fix the namespace of the datasets, you need to:

  1. Highlight the DataSet's XSD file in the solution explorer
  2. Open the property window
  3. Change the "Custom Tool Namespace" value to whatever you want the namespace to be (say, your application namespace)

I've noticed it will default the namespace of the dataset to the directory structure your file is in, which is kind of annoying unless your code structure explicitly follows your directory structure.

Banacek
  • 21
  • 2
0

You should refrences to all the dll's that you are accessing to your project, since it is not possible to tell which dll you are missing, you should find them yourself from errors and add them, also after that add their namespace to your class. That will resolve all the issues.

DeshDeep Singh
  • 1,817
  • 2
  • 23
  • 43