Alfred Nilsson Alfred Nilsson - 1 year ago 100
C# Question

VS2010 makes a copy of .Designer.cs-file

I'm using VS2010 (C#) for a WinForm database program. I've created a dataset, myds, which generates a couple of related files:

  • myds.xsd

  • myds.Designer.cs

  • myds.xsc

  • myds.xss

When I edit the xsd-file in design mode, perhaps just move around a TableAdapter, myds.Designer.cs makes a copy of itself to myds1.Designer.cs. After that I can't compile the program because the all the types and definitions becomes declared twice (they allready exists in the original myds.Designer.cs-file). It's quite annoying having to delete the copy every time I've made minor changes to that file. Why is it doing this, and can I prevent VS2010 from making this copy?

Answer Source

It is a known bug.


Unload the project containing your dataset.

Edit the project file (example 'datasetobjects.csproj') with text editor. If you have another datasets you can find rows as:

 <None Include="My_DS.xsd">

And the problem is in the row <LastGenOutput>My_DS.Designer.cs</LastGenOutput>. It may be misssing or incorrect for your DataSet.

Bug link.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download