I have a strange bug with my Linq to SQL DBML files, when ever I save it, instead of saving to the existing designer file a duplicate file is created.
This is causing errors all over the place as there is ambiguity between the data context constructor inside of file.designer.cs and file1.designer.cs
Is there any way to fix this error that doesnt involve deleting and recreating the dmbl files. as this error is happening on all of my DBML files some of which are rather large.
The above image shows the issue that I'm having.
Not sure what could have caused this (but Marc's suggestion about the file being readonly or not checked out seems possible), but the association is described in the .proj file. If you open that file with a text editor you should see somewhere within something like:
<ItemGroup>
<None Include="Minerva.dbml">
<Generator>MSLinqToSQLGenerator</Generator>
<LastGenOutput>Minerva1.designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</None>
Replace Minerva1.designer.cs
with Minerva.designer.cs
. You can now delete or exclude the Minerva1.designer.cs
file from you project and the next time the generator is invoked it will overwrite Minerva.designer.cs
as expected.
I had the same issue. It turns out version control was holding the file. The build process cannot recreate the file so it creates a new one. Since this file is automatically generated, it is safe to remove from the version control. I am using git for my version control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With