Support

Find out the answer to a question, or get in contact with us.

How do I configure web.config transforms for my project?

We understand that the server environment you are deploying your site to will nearly always require different settings to your local development environment. We support this by enabling a 3 stage web.config transform model to apply web.config changes to your application at deployment time.

This allows you to modify any of your application’s settings for each environment.

As an example you can edit things such as;

  • appSettings
  • connectionStrings
  • formAuthentication settings

Multi-layer web.config transformations

OnCheckin allows for 3 separate levels of web.config transforms to be applied, one after another. This is applied at the time your website is built. OnCheckin will search your website project folder for the transforms. Having these files in your project is optional but if they are found OnCheckin will apply them.

image

The first step the build process will take is to apply the web.release.config transform if it exists. OnCheckin builds your website in release mode and therefore applies the release transform.

The second step the build process takes is to apply an optional web.oncheckin.config transform if it exists. This is applied to all build and deployments completed by OnCheckin.

The third step the build process takes is to apply an optional environment based transform using the convention web.[environment name].config. The filename that OnCheckin searches for is taken from the deployment environment you are deploying to.

image

The above example shows a deployment environment being named “Staging”. In this case if you were to deploy to this environment OnCheckin would look for and apply the transform web.staging.config.

Creating an OnCheckin environment transform

The easiest way to create environment based transforms for your website project is to download our Visual Studio Extension “OnCheckin Web.config Transformer”.

This allows you to easily add an OnCheckin deployment transform to your web project by simply right clicking on your web.config file and opting to “Add Environment Transform”.

image

Then enter the name of the OnCheckin deployment environment you’d like to create a transform for.

image

This will create a file named web.[the name your enter].config. Enter the name for your environment and this will be used by your environment.

File format

The transform files that OnCheckin uses can be written in the same format that standard web.config transforms are written in, as defined on MSDN.

<connectionStrings>
  <!-- 
  This sets the connectionString value on the 
  'dbConnection' connection by matching it's 'name'
  -->
  <add name="dbConnection"
    connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
    xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<appSettings>
  <!-- 
  This replaces the whole appsetting node and finds it
  by matching the appSettings 'key'
  -->
  <add key="setting1" value="setting value"
        xdt:Transform="Replace" xdt:Locator="Match(key)"/>
</appSettings>
Get in Touch Reach us on Twitter Lodge a support request Schedule a support call View our Trello Roadmap

OnCheckin
41/330-370 Wattle Street
Ultimo, NSW Australia 2007
ABN: 81 163 095 681.
ACN: 163 095 681.

support@oncheckin.com
Australia: +61 2 8005 6783

Past release notes