Set Web Deploy parameter values in MSBuild
<p>I use MSBuild to build and deploy a web application.</p>

<pre><code> MSBuild.exe MySite.csproj /p:DeployOnBuild=True /p:WebPublishMethod=MSDeploy /p:MSDeployServiceURL=mysite.example.com
</code></pre>

<p>My site connects to a SQL Server database. </p>

<pre class="lang-xml prettyprint-override"><code>&lt;connectionStrings&gt;
  &lt;add name="dbconnection"
       connectionString ="Data Source=(local);Initial Catalog=MySite;Integrated Security=SSPI;"
       providerName="System.Data.SqlClient" /&gt;
&lt;/connectionStrings&gt;
</code></pre>

<p>I develop against a local database, but the connection string needs to be changed when the site is deployed to test or production servers.</p>

<p>I have declared a deployment parameter named <code>dbconnection</code> in a file named <code>parameters.xml</code></p>

<pre class="lang-xml prettyprint-override"><code>&lt;parameter name="dbconnection"
           defaultValue="Data Source={server};Initial Catalog={database};Integrated Security=SSPI;"
           tags="DBConnectionString"&gt; 
  &lt;parameterEntry type="XmlFile"
                  scope="\\Web.config$"
                  match="/configuration/connectionStrings/add[@name='dbconnection']/@connectionString"/&gt; 
&lt;/parameter&gt;
</code></pre>

<p>I could easily create a parameterized web deploy package and deploy it with msdeploy.</p>

<pre class="lang-none prettyprint-override"><code>msdeploy -verb:sync
         -source:package:MySite.zip
         -dest:iisApp="Site1/MySite"
         -setParam:name=dbconnection,value="Data Source=.\SQLEXPRESS;Initial Catalog=MySiteTest;Integrated Security=SSPI"
</code></pre>

<p>However, I'd really like to be able to do everything in MSBuild. What is the MSBuild equivalent of <code>-setParam</code>?</p>