Question

I've checked out a solution from source control and opened it in Visual Studio. My assumption is that this solution compiled at one time (two years ago) and was deployed.

There is a project that contains datasets which I will call the "dataset project". The datasets have connection strings defined in the InitConnection() method in Designer.cs files that are looking for a Properties namespace.

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    private void InitConnection() {
        this._connection = new global::System.Data.SqlClient.SqlConnection();
        this._connection.ConnectionString = global::<some namespace>.Properties.Settings.Default.<some connectionStringName>;
    }

In Solution Explorer, I see a Settings.settings file that appears to be "missing." Indeed, the Properties folder is empty when I check it's contents. The missing settings are compile errors in each dataset.

I've attempted to set the connection strings of the datasets to None, but it tries to save the new value to the .settings file, which fails with a "Warning 22 The custom tool 'SettingsSingleFileGenerator' failed while processing the file 'Properties\Settings.settings'.
" message -- ostensibly because the .settings file is missing.

A little more digging reveals a full compliment of connection strings found in another project which references the dataset project. But the dataset project does not (circularly) reference this other project and would have no way to use its connection strings that I'm aware of.

Can the .settings file be regenerated for the dataset project? Any reason why someone would delete .settings in the first place?

Thanks!

Was it helpful?

Solution

Figured it out.

I used Visual Studio to delete the phantom Settings.settings file under the Properties folder (the "phantom" file icon that the project thinks should be there because it's listed in the .csproj file). Then I opened the project Properties and went to the Settings tab. Visual Studio prompted me to create a new settings file. I happily obliged, and VS automagically imported the settings from app.config.

So it seems there is a way to regenerate the Settings.settings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top