Reputation: 487
I am trying to add a Dataset (.xsd) to my Visual Studio project. I am referencing an existing database table.
I performed the following steps:
When I save, I get several dozen errors like the following:
The type name 'SqlParameter' could not be found in the namespace 'System.Data.SqlClient'
'MyDataTable' does not contain a definition for 'Prefix' and no accessible extension method 'Prefix' accepting a first argument of type 'MyDataTable' could be found (are you missing a using directive or an assembly reference?)
'MyDataTable.Clone()': no suitable method found to override
I tried deleting the Dataset and restarting from scratch and the same issue occurred, which means something in my workflow is causing this.
To compare, I opened a project that I built a few months with the same version of VS using the Dataset class and referencing the same database, and it has no obvious differences.
I also deleted the .vs folder from the project root, as that can sometimes cause reference weirdness.
There's not much to show code-wise, it's all auto-generated by VS, but the error above were copied out of the VS Error List panel.
I need help figuring out what settings/configurations I have set up incorrectly in Visual Studio that are causing this issue.
Upvotes: 1
Views: 778
Reputation: 487
In case anyone else has run into this issue, Visual Studio 2017 doesn't always include all of the references/libraries it needs when using the wizard to set up a Dataset.
In my case, I had to manually add references to System.Data.SqlClient
and System.Data.DatasetExtensions
from NuGet, even though they were only used by auto-generated classes.
Upvotes: 1