views:

112

answers:

1

This is driving me nuts. I think it is because of some connection string mismatching across the app (using MVC) but Visual Studio constantly takes my .designer.cs file and recreates it adding a '1' at the end (or 2 if it already did this before argh!). My question is two-fold: Is there a way to stop VS from doing this? But more importantly: How can I manually set it back to the original .designer.cs or is that not possible? I try to delete the new one it created (because I keep getting duplicate definition build errors) and it won't automatically associate back with the original one in the DMBL file structure in solution explorer.

Does anyone have a solution for this madness?

+1  A: 

Not an ideal solution, but a workaround would be the following. In Visual Studio, go into the properties of the .dbml file and clear out the Custom Tool property. This will prevent it from running the auto-generator against the DBML and creating the designer files. Of course further changes to the DBML won't be reflected in the designer file.

As for why it's generating multiple designer files, that's an oddity. To manually associate a file under another, you need to modify the project file. Look for a line like

<Compile Include="file.designer.cs" />

and change it to

<Compile Include="file.designer.cs">
    <DependentUpon>file.dbml</DependentUpon>
</Compile>
Agent_9191
Thanks for the detail, you'd think they would just let me flag some option somewhere to have it overwrite the old one instead of making this new one + "1"
shogun
Like I said, it's odd it's creating additional designer files. It should be updating the existing file instead.
Agent_9191