Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird "Designer1.cs" files created

How does visual studio link files to their corresponding designer.cs files? I have a strange situation that's occurred with both the DataSet designer and also the L2S DBML designer where it's ignoring the DataSet.Designer.cs and has created and used a DataSet.Designer1.cs instead. How can I switch it back?

like image 950
Neil Barnwell Avatar asked Mar 31 '10 09:03

Neil Barnwell


2 Answers

Thanks to Zendar's suggestion, this is what I did:

  1. Close Visual Studio.
  2. Use TortoiseSVN to rename the DataContext1.designer.cs file to DataContext.designer.cs, so the rename is picked up by source control.
  3. Opened MyProject.csproj in Textpad.
  4. Performed search and replace for DataContext1.designer with DataContext.designer (found 2 instances).
  5. Save and close.

Re-opening and building the solution in Visual Studio confirmed this worked. Thanks Zendar!

like image 194
Neil Barnwell Avatar answered Nov 14 '22 03:11

Neil Barnwell


Information about related files is written in project files (*.csproj). This may fix problem:

  1. exclude DataSet designer from project
  2. close Visual studio
  3. remove Designer1.cs from disk
  4. remove Designer.cs from disk (if it exists)
  5. start Visual studio
  6. open DataSet designer
  7. now you should have Designer.cs

Alternative would be to try to change information in *.csproj file and then to rename Designer1 to Designer in all places it occurs. I did not try this, but it may work.

like image 8
zendar Avatar answered Nov 14 '22 03:11

zendar