1
votes

I am setting up build and release pipelines in Azure DevOps for a new project. I mirrored this off an existing project that has been working for a while now.

The problem is that the connection strings aren't transforming by XML or by the release pipeline variable substitution.

I have the following arguments passed during the build phase:

/p:AutoParameterizationWebConfigConnectionStrings=false /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

Yet, in both projects when I release with system.debug=true, I see this error:

ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation.

I do have both the XML transformation and the XML variable substitution boxes checked on the release pipeline.

I've tried to get this working all day to no avail.

Anyone have any other thoughts or suggestions?

1
How did you transform the settings? Please try to disable this by adding this to the project file and check if that works. <AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings> In addition, please reference this blog to check if that helps for your troubleshooting : Using XML Transformations when deploying to Azure App Service using VSTSAndy Li-MSFT
@AndyLi-MSFT I have both the normal .NET Framework web config transforms using the xtd:Transform(Replace) and xtd:Locator(name) setup, as well as release pipeline variable substitution in place. I already followed the steps on the blog you mentioned as we have done this in other projects without an issue. The other projects don't have the project file modified and only use the build argument to disable parameterization and seem to work just fine, at least until now. Could something in DevOps have changed in how they handle this when it comes time to release?Don Sartain
@AndyLi-MSFT I just tried adding that parameter and get the same parameterization warning in the release after I ran a new build.Don Sartain
Now that I put the tag in the right place, under the release build property group, it worked as expected. Still confused as to why the build argument didn't work, but this at least gets me unblocked. Thanks!Don Sartain
Suggest you try other projects/pipelines to check if they have the same issue. Whatever, glad to know that the issue was unblocked, I have posted the workaround as an answer, this can be beneficial to others who have the same issue.Andy Li-MSFT

1 Answers

0
votes

As a workaround, please try to disable auto-parameterization by adding the following string to the project file and check if that works. (Make sure put the tag in the right place, such as you mentioned in your scenario : under the release build property group)

<AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings>

In addition, please reference this blog to check if that helps for your troubleshooting : Using XML Transformations when deploying to Azure App Service using VSTS