Dataset Designer Issue - Visual Studio 2008

2019-03-26 16:35发布

We're using a dataset to throw a small amount of data around amongst various nodes within our application.

The dataset is in an assembly by itself as it is reference from many other components.

The Visual Studio dataset tool has developed a strange habit of creating a new designer everytime a build is done.

So, the project looks like this

MyDataSet.xsd
 - MyDataSet.cs
 - MyDataset.designer.cs
 - ....

Then a build is performed and the result is

MyDataSet.xsd
 - MyDataSet.cs
 - MyDataset.designer.cs
 - MyDataset1.designer.cs
 - ....

The MyDataSet1 designer contains the new changes and the original designer is unchanged. My current solution is to replace MyDataset.designer with MyDataset1.designer then rebuild.

Its a minor inconvenience but if anyone makes a change and doesn't perform the above the resulting assembly doesn't contain their changes.

Any suggestions, other than not using datasets?

4条回答
做个烂人
2楼-- · 2019-03-26 17:18

Close your project. Edit the project.csproj file in XML mode. You will find an entry in the group that reads:

<None Include="*myDataSet*.xsd">
  <SubType>Designer</SubType>
  <Generator>MSDataSetGenerator</Generator>
  <LastGenOutput>*myDataSet*1.Designer.cs</LastGenOutput>
</None>

Change the item to remove the "1". Save and close the file. Reopen your project.

When you regenerate your dataset, it should be back to normal.

查看更多
太酷不给撩
3楼-- · 2019-03-26 17:27
  1. Unload your project from VS.
  2. Edit the project file in notepad.
  3. delete 1 from the related element's value.
  4. open the project in VS again.
查看更多
该账号已被封号
4楼-- · 2019-03-26 17:28

I have had this problem once but don't remember exactly how I fixed it.

I believe I did :

  • Delete all de *.cs files behind the XSD (they are generated so no probl). You can do this from the solution explorer.

I that is not enough..

  • Delete all *.cs files behind the XSD and then remove the esd from the project. (copy it to a backup location) And then add it bij "add existing file" from backup location.
查看更多
Rolldiameter
5楼-- · 2019-03-26 17:30

From what I understand, you can right-click on the data set in the Data Sources tab. Hit the Configure Dataset with wizard and choose the new or modified data objects, and you should be good to go.

查看更多
登录 后发表回答