MSBuild : app.config is getting transformed for given environement but app.exe.config is not getting transformed

I am using MSBuild.exe to build our application. Along with App.Config, I have App.prod.config, app.qa.config, app.dev.config files.

On the command line, I enter following

C:\XXX\MyProject> C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe myBuildFile.build /p:Configuration=DEV

Above command, looks for app.config and app.dev.config files, Transform placeholders in App.dev.config & generate app.cofig file with entries from app.dev.config file.

After project is compiled, app.exe.config file is created. All this is working fine for me.

But for production, I am getting correctly transformed app.config file but the app.exe.config file is same as the default app.config file (without any tranformation)

Following is the app.prod.config file:

<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations 
     see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <connectionStrings>
       <add name="EventStore"
             connectionString="XXXXXXXXXXX"
             providerName="System.Data.SqlClient"
             xdt:Transform="SetAttributes"
             xdt:Locator="Match(name)"/>
    <add name="Profile"
         connectionString="XXXXXX"
         providerName="System.Data.SqlClient"
         xdt:Transform="SetAttributes"
         xdt:Locator="Match(name)"/>
    <add name="IdentityDB"
         connectionString="XXXXXXXXXXXXXXXXXXXXXXXX"
         providerName="System.Data.OracleClient"
         xdt:Transform="SetAttributes"
         xdt:Locator="Match(name)"/>
  </connectionStrings>
  <appSettings>
    <add key="ApplicationName"
         value="PROD"
         xdt:Transform="SetAttributes"
         xdt:Locator="Match(key)"/>
     </appSettings>
  <system.web>
    <compilation xdt:Transform="RemoveAttributes(Debug)" />
  </system.web>
</configuration>

Answers


By default, web.config is transformed on publish only. If you want to transform app.config or an xml document, then the best option is to install a Visual Studio extension called SlowCheetah


Need Your Help

Joomla JCE removes textarea required attribute

php forms joomla joomla3.0 jce

I use a php script that inserts into jos_content table some kind of content in order to create article. Among this, there is a textarea with the attribute required.