84231

App.config only for my developer machine

Question:

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?

Answer1:

You can have an app.config for each environment, if is this what you are looking for. Try this: <a href="http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx" rel="nofollow">http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx</a>

Answer2:

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.

Answer3:

To do this, you need to exclude <em>web.config</em> or <em>app.config</em> from source control.

Answer4:

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.

Answer5:

Depending on what exactly you are trying to achieve, you may find <a href="http://msdn.microsoft.com/en-us/library/ms229697.aspx" rel="nofollow">Machine.config</a> helpful.

Answer6:

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.

Answer7:

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.

Recommend

  • Specifying Tomcat 7 to use port 8443 only in Eclipse
  • Work with git on Windows 7 machine [duplicate]
  • Make a whole row in a table “link-able”
  • Append array values to another array by keys comparison
  • Using uploadify with ashx handler
  • How can I add padding-right to an input type=“number” when aligning right?
  • How to create instance variables explicitly?
  • JMeter parametrize variable. how to switch between url variable
  • Storing Images in a mysql database
  • How to bind a single object instance in WPF?
  • Using DI in ConfigureService-Methods (especially IApplicationLifetime) in .NET Core
  • How can I test the validity of a ReferenceProperty in Appengine?
  • Declaration of does not work with Ionic's ion-nav-view in IBM MobileFirst
  • Prolog Query - Trying to understand how this result happens
  • PDF using WCF Restful Services
  • How can I replace the server in Web Component Tester
  • MYSQ & MVC3 SQL connection error \\ ProviderManifestToken but I am using MySQL
  • Asynchronous UI Testing in Xcode With Swift
  • ilmerge with a PFX file
  • Why value captured by reference in lambda is broken? [duplicate]
  • Fetching methods from BroadcastReceiver to update UI
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Invalid access key error using credentials redeemed from an amazon open id token
  • Circular dependency while pushing http interceptor
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Proper folder structure for lots of source files
  • JTable with a ScrollPane misbehaving
  • Angular 2 constructor injection vs direct access
  • Why joiner is not used after Sequence generator or Update statergy
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • Recursive/Hierarchical Query Using Postgres
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?