Today's WPP vs MSDeploy issue is declaring parameters that need to be ignored at deployment time.

Why would I want to declare a parameter, only to ignore it? I'm a big fan of continuous delivery, and one of it's tenants is to only create build artifacts once and deploy them to various environments (dev, uat, staging, live), as it guarantees that what you deploy is what you tested.

MSDeploy actually provides two (subtlely different) ways of skipping a parameter. The removeParam argument can be used to remove the parameter definition for the current deployment. Alternatively, the parameter can be decorated with a <parameterValidation kind="AllowEmpty" /> element to allow parameter values of empty strings.

Unfortunately, neither of these MSDeploy features are supported by the Web Publish Pipeline.

The only workaround for removeParam is to perform your deployments using MSDeploy directly, since there's no way to specify custom command line arguments via the MSDeploy (or VsMsDeploy) tasks.

Fortunately, there is a workaround for the parameterValidation method, which ended up being what I needed. I found the workaround after snooping through Microsoft.Web.Publishing.targets (in %programfiles%\MSBuild\VisualStudio\v11.0\Web), a wealth of obfuscated knowledge on WPP features that are not-so-documented.

It turns out that WPP will actually load a Parameters.xml file (technically $(ProjectParametersXMLFile)) from the root of the web application and merge any parameters with those declared in WPP (including Project.wpp.targets) using MSDeployDeclareParameters. For example, the following Parameters.xml declares an optional text-replace parameter:

<parameters>
   <parameter name="ReplaceVariable"
              description="Sample variable that allows empty values" defaultValue="">
      <parameterValidation kind="AllowEmpty" />
      <parameterEntry type="TextFile" scope="Web\.config$" match="TextToReplace" />
    </parameter>
</parameters>

You can now deploy the application while specifying an empty parameter value for ReplaceVariable

External links: