change ConnectionString per build in app.config

NachitoMax 411 Reputation points
2022-08-23T03:38:02.507+00:00

Hey

I have been looking at the Add Config Transform to change my app.config file depending on my build. This provides 2 decendent app.config files like this

app.config
app.Debug.config
app.Release.config

The idea is that when you build, you can load the respective config file required.

I need my debug.config to contain a connection string so that i can preview reports in design and the release.config not have a connection string at all because i add it using code.

The Add Config Transform doesnt appear to come with well documented instructions so im unsure as to what i need to do. The 2 decendent files contain very little data.

My questions

  1. Do i need to add all of the xml from the parent config to the decendents or just the code to make the connection string change?
  2. how do i set it up to generate the corredct app.config containing the correct build type xml?

Are there ay examples?

Thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,417 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,126 questions
{count} votes