Search code examples
c#xsddatasettyped

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?


Solution

  • It is a known bug.

    Solution

    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">
          <SubType>Designer</SubType>
          <Generator>MSDataSetGenerator</Generator>
          <LastGenOutput>My_DS.Designer.cs</LastGenOutput>
     </None>
    

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

    Bug link.