9

I am setting up my application for CI&D. I created a DEV-Deploy web.config transform which contains the connection strings for the dev testing environment.

Web config transforms

Here are the contents of the Web.DEV-Deploy.config connection string section:

  <connectionStrings xdt:Transform="RemoveAttributes(configSource)">
    <add name="DbContext"
      providerName="MySql.Data.MySqlClient"
      connectionString="CXN_STRING"
      xdt:Transform="Insert" xdt:Locator="Match(name)"/>
    <add name="elmah"
      connectionString="CXN_STRING"
      xdt:Transform="Insert" xdt:Locator="Match(name)"/>
  </connectionStrings>

It should look like:

  <connectionStrings>
    <add name="DbContext" providerName="MySql.Data.MySqlClient"
      connectionString="CXN_STRING"/>
    <add name="elmah" connectionString="CXN_STRING"/>
  </connectionStrings>

I'm building using the command line and I have tried the following commands, neither of which work:

msbuild web\web.csproj /T:Package /P:Configuration=DEV-Deploy /P:TransformConfigFiles=true
msbuild web\web.csproj /T:Package /P:Configuration=DEV-Deploy /t:TransformWebConfig

The deploy task looks like this:

web.deploy.cmd /Y /M:https://MACHINEIP:8172/msdeploy.axd -allowUntrusted /U:USERNAME /P:PASSWORD /A:Basic

The web.config looks like this upon deployment:

<connectionStrings configSource="connectionStrings.config"></connectionStrings>

I have tested to the best of my ability on my local machine and have not been able to duplicate the issue. What do I need to do to get the transform working correctly on the build?

1
  • 1
    This question appears to be off-topic because it is about a wrong path, not about programming (too localized)
    – bummi
    Commented Sep 13, 2013 at 11:50

1 Answer 1

3

Our CI&D team put the build/deploy scripts into source control and after looking them over, everything above was correct, the problem was the path for the build command was wrong while the command itself was correct.

Once that was updated the web.config transformed correctly.

1
  • May I ask what you used for /T:Package ? How do I create a "package" build target? Commented May 5, 2015 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.