Skip to content

Instantly share code, notes, and snippets.

@blair55
Created May 22, 2013 22:43
Show Gist options
  • Save blair55/5631548 to your computer and use it in GitHub Desktop.
Save blair55/5631548 to your computer and use it in GitHub Desktop.
Specifying Environment Variables at Deploy Time not at Build Time
MyProject.deploy.cmd
/y /M:https://MyHostMachine:8172/MsDeploy.axd
/u:MyUserName /p:MyPassword /A:Basic -allowUntrusted
"-setParam:name='IIS Web Application Name',value='MyIISWebAppName'"
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site/MyWebProject_deploy" />
<setParameter name="MyDatabase-Web.config Connection String" value="MyDefaultConnectionString" />
</parameters>
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site/MyWebProject_deploy" />
<setParameter name="MyDatabase-Web.config Connection String" value="MyDefaultConnectionString" />
<setParameter name="My Service Url" value="http://MyTestServiceUrl.com/" />
</parameters>
MyProject.deploy.cmd
/y /M:https://%Target.MachineName%:8172/MsDeploy.axd
/u:%Target.Username% /p:%Target.Password% /A:Basic -allowUntrusted
"-setParam:name='IIS Web Application Name',value='%Target.IISApplicationName%'"
"-setParam:name='My Service Url',value='%MyServiceUrl%'"
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<parameter name="My Service Url" description="" defaultValue="http://MyTestServiceUrl.com/">
<parameterEntry kind="XmlFile" scope="Web.config" match="/configuration/appSettings/add[@key='MyServiceUrl']/@value" />
</parameter>
</parameters>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment