I'm trying to configure a build and release pipeline in VSTS so that I can push a build to a variety of environments. To accomplish this, I'm leveraging the parameters.xml file for MSDeploy, as well as using a Tokenizer task to overwrite the tokens that are set in the SetParameters.xml file after.
When I deploy to the site, it does reach the destination computer and deploy there, but the path is incorrect. Instead of copying to the virtual directory of the web application that I've specified in parameters.xml, it seems to take the path that is in the package and copies that (so, C:\agent_work...).
I know that the tokenizer and at least part of parameters.xml and SetParameters.xml is working and correctly transforming connection strings, as the generated web.config does have those values correct, but the IIS Web Application Name parameter doesn't seem to be working.
I did get this to work if I create my own publish profile and hard code the site name in the DeployIisAppPath and use that to package instead. This isn't ideal, though, as I want to have the site name as a parameter.
Here are all relevant files. Let me know if you need more info. Thanks so much in advance!
parameters.xml
<parameters>
<parameter name="IIS Web Application Name"
description="Please specify the IIS Web Application Name"
defaultValue="__IISWebApplicationName__">
<parameterentry kind="ProviderPath"
scope="IisApp"
match="@defaultValue">
</parameterentry>
</parameter>
</parameters>
VS Solution Build Task Arguments
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation=$(build.artifactstagingdirectory)
/p:AllowUntrustedCertificate=true
/p:IncludeSetAclProviderOnDestination=False
/p:DeployOnBuild=true
/p:AllowUntrustedCertificate=true
/p:WebPublishMethod=Package
/p:SkipInvalidConfigurations=true
/p:DisableAllVSGeneratedMSDeployParameter=true
SetParameters.xml after packaging
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="__IISWebApplicationName__" />
</parameters>
Release Task Environment Variable Configuration
Name = IISWebApplicationName
Value = Site Name
MSDeploy Configuration
Destination Provider: auto
Destination Computer: https://{server}:8172/msdeploy.axd?site=$(IISWebApplicationName)
MSDeploy Commmand
msdeploy.exe -verb:sync -source:package='C:\agent\_work\r4\a\{buildName}\drop\{packageName}' -dest:auto,computerName='https://{server}:8172/msdeploy.axd?site=Site Name',userName='xxx',password='xxx',authType='basic',includeAcls='False' -allowUntrusted -setParamFile=C:\path\to\param\file -verbose
You can deploy web app to IIS by using IIS Web App Deploy task, then you just need to specify Website name with variable directly.
On the other hand, the WinRM: IIS Web App Deployment task in IIS Web App Deployment Using WinRM extension works fine two (Do not need to configure deployment group.)