Using DestinationVirtualDirectory in msdeploy to set Physical Path Location

1.5k views Asked by At

This seems like it should be very straight forward but it is not working for me and I am out of ideas.

All I want to do is set the physical path when I deploy a package using msdeploy so that it doesn't go to the default inetpub\wwwroot location.

msdeploy -verb:sync -source:package="D:\PATH\TO\PACKAGE.zip" -dest:iisapp="Default Web Site/SiteName" -setParam:kind=DestinationVirtualDirectory,scope="Default Web Site/SiteName",value="C:\Program Files\Physical\Location"

I feel like I must be missing something obvious.

2

There are 2 answers

0
chief7 On

I've done this by adding an additional command (appcmd) to the MSDeploy package manifest to change the physical path of the IIS site during the deployment:

<runcommand path="%windir%\system32\inetsrv\appcmd set app /app.name:&quot;Default Web Site/app12&quot; /&#91;path='/'&#93;.physicalPath:C:\temp\app12" waitInterval="5000"/>

http://www.dotnetcatch.com/2016/06/28/webdeploymsdeploy-quick-tip-change-iis-siteapp-physical-path-with-msdeploy/

0
TerrorBight On

The following changes the physical directory of a virtual application on a remote machine

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:apphostconfig="my-website-name\my-virtual-application-name",computername=my-computer-name,username=my-service-account-username,password=my-service-account-password -dest:package=template.zip -declareParam:name="destVirtualDir",kind=DestinationVirtualDirectory,scope="my-website-name",defaultValue="c:\my-default-folder-name"

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package=template.zip -dest:apphostconfig="my-website-name/my-virtual-application-name",computername=my-computer-name,username=my-service-account-username,password=my-service-account-password -setParam:name="destVirtualDir",value="c:\my-new-folder-name" 

To make sure no copying of source and target occurs you can add

-enableRule:Donotdeleterule -skip:objectName=filepath,absolutePath=.*

The above was 'inspired' by https://forums.iis.net/t/1169416.aspx which also shows how to make other website and virtual app changes