How to apply config transformations to an external config file

There are few workarounds:

Workaround 1

  • Write AppSettings.Debug.config, AppSettings.Release.config with full values (not with transform attributes)
  • In your web.config, using transformation, substitute with the appropriate file:

web.debug.config

<appSettings file="AppSettings.debug.config" 
             xdt:Transform="SetAttributes" xdt:Locator="Match(file)"/>

web.release.config

<appSettings file="AppSettings.release.config" 
             xdt:Transform="SetAttributes" xdt:Locator="Match(file)"/>

Its less than ideal, kinda defeats the purpose of transforms but may be appropriate based on one’s situation than using something like SlowCheetah.

Workaround 2

Use TransformXml build task to transform your files during build as pointed here and here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)