Split Global Settings

When developing locally and then deploying to a staging or production environment, you typically also transfer the globalsettings.config file – a file containing system settings.

In most cases you will have some settings appropriate to the development environment which you don’t want to transfer to staging or production – for instane database-settings, as the local database is obviously not the same as the staging or production database.

In case you want to deploy from development without overwriting all the global settings on the destination you can create split global settings files on the destination.

To create e.g. a split global settings file with the database connection settings:

  1. Open the destination solution
  2. Create a separate config file with the parts you want to keep persistant – in this case the Database details
<?xml version="1.0"?> <Globalsettings> <System> <Database> <Password>yourpassword</Password> <Type>ms_sqlserver</Type> <UserName>yourusername</UserName> <Database>yourdatabase</Database> <SQLServer>yoursqlserver</SQLServer> </Database> </System> </Globalsettings>
  1. Name the file GlobalSettings.[SomeSection].config – in this case GlobalSettings.Database.config and place it in the same folder as the main GlobalSettings.config file.

When a solution starts up, the contents of the split off config file is used in place of the contents of the main globalsettings.config file.

On your local development environment you don’t use a split global settings file, so that when you deploy the split off config file is not overwritten and the split off sections of the global settings are not overwritten.