Reputation: 45023
Can I create app.config or web.config file that applies only to my developer machine, as opposed to using the default configuration files that are checked into source control?
Upvotes: 1
Views: 496
Reputation: 1094
If you want configuration that applies only to your machine and each developer will likely be doing the same thing then you can do as we do and have only a minimum configuration in the web.config that is part of the solution and the rest in your global web.config or machine.config (if you need to also have some desktop apps use it). We do this to create an isolated environment between dev/qa/staging/prod and it is still easy to push from one environment to the next without having to edit the config files or worry about overwriting them. We also further isolate our environments by include host file entries that only allow machines in dev communicate with others at the same level. Likewise for qa/staging/prod.
Upvotes: 0
Reputation: 37215
Use a copy of web.config named web.svn.config to be under source control.
That way, the source-controlled config file (web.svn.config) contains all required settings, and each developer can maintain their own config files (web.config) on their dev machines.
Upvotes: 0
Reputation: 3502
I would recomend using separate config files that are referred to by your app.config or web.config.
For example in your web.config you would have:
<configuration>
<appSettings file="Config/LocalDev.config">
</appSettings>
</configuration>
And then in Config/LocalDev.config you would have
<appSettings>
<add key="SomeKey" value="SomeValue"/>
<add key="AnotherKey" value="AnotherValue"/>
</appSettings>
You would also create a Config/Production.config file with your production settings. Then all you have to do is edit the appSettings file in your web.config when you deploy.
Upvotes: 3
Reputation: 2741
You can have an app.config for each environment, if is this what you are looking for. Try this: http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx
Upvotes: 1
Reputation: 14348
Depending on what exactly you are trying to achieve, you may find Machine.config helpful.
Upvotes: 0
Reputation: 19228
To do this, you need to exclude web.config or app.config from source control.
Upvotes: 1
Reputation: 1093
What I would recommend doing is checking in an "app.config.backup" file whilst ignoring all app.configs. This will allow you to modify your own app.config accordingly without interfering with other developer's machines, whilst at the same time allowing for updates to the existing "base" configuration.
Upvotes: 0