1
votes

I'm having trouble setting up my release build on VSTS. I have a web app that is deployed to a dev environment on each build. After which we can choose to deploy that release to the Production or Test environment.

On going to the Prod environment, I want to use the web.release.config to replace the variables for connection string, app settings, etc. This works fine but it does it for both releases, DEV and PROD.

I.E. if I provide the correct prod connection string in the web.release.config, it is deployed to the Dev site on the first build release.

I suspect that the Build is doing this rather than the release.

How do I prevent the web.release.config from being applied to the default DEV build?

The pic shows the release config, the Dev one does not have the xml transform checked.

enter image description here

this is the transform that is only in the Web.Release.Config file.

enter image description here

Any assistance in getting the release to swap the config values for PROD only would be much appreciated.

Is it the BUILD and not the release???

using visual studio 2017 preview of 15.3 version checking in to VSTS for build and releases.

Best Regards, Rod

1

1 Answers

1
votes

I assume you build and deploy the project/solution with Release configuration, so the web.config file has already been transformed.

You can refer to these steps below to deal with this issue:

  1. Create a new Configuration based on the release configuration (right click the solution>Configuration Manager> Click Configuration DropdownList>New> Select Release in Copy settings from> Type Dev in Name
  2. Add a new config file: web.Dev.config and set the connectionstring string for dev environment
  3. Check in pending changes
  4. Edit build definition to build project/solution with Dev configuration
  5. Add web.release.config file to the same level of web.config (E.g. Copy file) and publish to artifact

On the other hand, you can use XML variable substitution option instead, with this way, you don’t need to add web.xxx.config file to the same level of web.config:

  1. Edit release definition
  2. Select an environment> Click …>Configure variables
  3. Add a variable (Name: [ConnectionString name, such as DefaultConnection]; value:[connectionstring value, such as Data source=xxx….]
  4. Check XML variable substitution option for Azure App Service Deploy task
  5. After that the related connectionstring value will be updated with that environment variable during transform.