Properties.Settings Ambiguity after adding LINQ to SQL
I have recently linked a database to my C# service by creating a LINQ to SQL item in my solution. Everything was fine and dandy as I was continuing to code, but then I suddenly noticed that there where 16 Ambiguity errors. e.g.
Ambiguity between 'EmailService.Properties.Settings.defaultInstance' and 'EmailService.Properties.Settings.defaultInstance'
What happened was that the database file decided to create it's开发者_StackOverflow中文版 own Setting.Designer.cs; So now I have a Settings.Designer.cs and a Settings1.Designer.cs (which was created by the LINQ to SQL file) in my Properties folder.
Is there anyway that I can change where the database file is referencing its settings so I can delete the duplicate?
I fixed it manually.
I had to use find and replace to replace all instances that were referencing to Settings1.settings since I couldn't use refactoring; then I had to delete the Settings1.settings file.
You must however make sure that you do not miss a reference otherwise another Settings1.settings will be automatically generated when you rebuild your solution.
I deleted Settings1 file and that seemed to have done the trick...
In the dbml designer, in the DataContext properties, there's an option to use app settings that's enabled by default. If you set it to false, it will no longer generate the settings class.
精彩评论