2

Everything I've read on the subject seems to be outdated and I can't find an answer to this seemingly common task.

I've been able to get Bamboo to do an MSBuild using a publish profile with:

/p:DeployOnBuild=true
/p:PublishProfile=MY_PROFILE
/p:Configuration=MY_CONFIG
/p:VisualStudioVersion=12.0
/p:AspnetMergePath="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools"

However, that would only transform the Web.config for one environment. I want to do one build, and then be able to deploy (using bamboo's deployments - which will probably run a msdeploy task?) to multiple environments as they pass each stage; QA -> Staging -> Production.

Is there a way to do a simple build, then do the transformations during the deployment stage?

I'm currently using Bamboo, MSBuild 14. .NET 4.5.2, and VisualStudio 2017 (v12.0).

gin93r
  • 1,551
  • 4
  • 21
  • 39
  • I just answered how to create multiple transformations (on build) and then pick the one you want during the deploy plan, does this help ? https://stackoverflow.com/a/52922895/1089267 – thinkOfaNumber Oct 22 '18 at 05:47
  • Oh, I actually solved this a while ago using Parameters.xml / SetParameters.xml. Thanks for the comment though. :D – gin93r Oct 22 '18 at 14:09

1 Answers1

1

PackageWeb does exactly what you need. It includes the XML transform files into the package and then transforms web.configs before deploying.

PackageWeb website and a tutorial.

I'm not sure if this project is maintained anymore.


Another option would be to use Parameters.xml and SetParameters.xml. It is basically a way to parametrize a web deploy package. See a tutorial.

Finally here is a very long discussion about this topic.

Dávid Molnár
  • 10,673
  • 7
  • 30
  • 55
  • Thanks! I'll have to look more into this when I get a moment. The latter option seems to be better, but I need to see if it plays nice with Bamboo. – gin93r Sep 11 '17 at 12:00
  • I'm curious - am I supposed to replace the `SetParameters.xml` file at some point? I've done some tests and creating the file doesn't get used. The `Parameters.xml` file does get created and a `SetParameters.xml` gets created with the key/values in my `Parameters.xml` file, but I don't know how to replace that. Would I use the publish profiles? – gin93r Sep 11 '17 at 16:41
  • `Parameters.xml` lives in your project folder. It says what you want to parametrize. You create it only once. You could create a `SetParameters.xml` for every environment - replace the file before deploying. – Dávid Molnár Sep 11 '17 at 18:23