Web Deployment Tool (MS Deploy)
Restore one site from package containing multiple sites
Last post Aug 27, 2018 02:59 PM by JoeT99
Aug 27, 2018 02:55 AM|JoeT99|LINK
We create a msdeploy package for multiple sites as follows:
"c:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:manifest=MultipleSitesMultipleProviders.xml -dest:package=Test.zip,encryptPassword="password" -disableLink:ContentExtension -enableLink:AppPoolExtension
Content of MultipleSitesMultipleProviders.xml:
<appHostConfig path="SITE1" />
<appPoolNetFx path="SITE1" />
<dirPath path="C:\SITES\SITE1" />
<appHostConfig path="SITE2" />
<appPoolNetFx path="SITE2" />
<dirPath path="C:\SITES\SITE2" />
<appHostConfig path="SITE3" />
<appPoolNetFx path="SITE3" />
<dirPath path="C:\SITES\SITE3" />
And here is how that package is restored:
"c:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -dest:auto -source:package=Test.zip,encryptPassword="password"
This restores all three sites. The problem I'm trying to solve is how to tell msdeploy.exe to restore just one of the sites that I specify somehow. I'm thinking this might be done using a -skip parameter which
would tell the deploy to skip the two sites we don't want to install. But I could not understand what the format of that this command might look like.
Here is one wild guess of what I could try passing which did nothing:
Is this even possible to do? Any help would sure be appreciated! Thank you.
Aug 27, 2018 02:59 PM|JoeT99|LINK
Answering my own question.
Found out how to do this. All sites except SITE1 are excluded. You need to work with archive.xml in the package zip file and come up with xpath expressions that will exclude the six elements that are generated by the six MultipleSitesMultipleProviders.xml
The xpath that prevented the copying of the files was tricky because the element in archive.xml is 'MSDeploy.dirPath' and you'd think the xpath expression would be //MSDeploy.dirPath[@path='C:\SITES\SITE3'] but that had didn't work while //dirPath[@path='C:\SITES\SITE3']
did work. Don't know why that is the case.
-skip=xPath=//appHostConfig[@path='SITE2'] -skip:xPath=//appPoolNetFx[@Site='SITE2'] -skip:xPath=//dirPath[@path='C:\SITES\SITE2'] -skip=xPath=//appHostConfig[@path='SITE3'] -skip:xPath=//appPoolNetFx[@Site='SITE3'] -skip:xPath=//dirPath[@path='C:\SITES\SITE3']
For what it's worth I found this extremely hard to figure out and don't understand why it was never spelled out anywhere that I could see how simple this problem is to solve: 1) Look at archive.xml, 2) add skip xPath for the elments needing to be excluded.
Would have saved me several days of aggravation trying to track this down. Hope this can be of help to others in the future.