Disable automatic ConnectionString parameterization in WebDeploy

 

In this post I would like to show you how to disable automatic connectionString parameterization in WebDeploy.  By default WebDeploy parameterizes all the ConnectionStrings in the web.config for a project.  This always confuses developers when they are first converting over to parameterization from config transforms.

You can open the resulting MSDeploy package zip file and the parameters.xml file to find parameter entries for each of your connections string with the name:

You can use these with no problem but the names are a bit long in my opinion and its odd that some of our parameters are automatically created but others aren’t.  In addition, the ParameterizationPreview VS extension doesn’t take these automatically generated parameters into account.

AutoParameterizationWebConfigConnectionStrings

If this really bothers you don’t dismay, you can disable this behavior by creating a [projectname].wpp.targets file and adding the following MSBuild property:

Or you can pass the property as an MSBuild argument:

/p:autoparameterizationwebconfigconnectionstrings=false

hflbnner