Table of Contents

IT:AD:MSDeploy:HowTo:A Summary of the MSDeploy Syntax

General

The MSDeploy command

The principal elements of the Msdeploy.exe command line are:

msdeploy.exe -verb:<verbName>
         -source:<provider>[=<pathToProviderObject>
                  [,<providerSetting>=<providerSettingValue>]]
         [-dest:<provider>[=<pathToProviderObject>
                  [,<providerSetting>=<providerSettingValue>]]
         ]
         [-<MSDeployOperationSetting> ...]

Where:

Verbs

The most import MSDeploy flags are the -verb, and the -provider flags.

The -verb flag defines whether we are investigating (-dumping) something on a -source, or -syncing from a -source to a -dest:

Verb options are:
* dump: Displays the information from the source object * sync: Syncs data between source and target * migrate: Migrates an IIS 6 web server to IIS 7 * GetDependencies: List source machine dependencies that would need to be installed on the target machine

Providers

There are a myriad of Providers to choose from (see MSDN.aspx)).

WebDeploy uses only a small fraction of them (package, setAcl, etc.)

appHostConfig

appHostSchema

* Ref: [http://bit.ly/wd3jw1]:

Syncs a local AppPool to a remote one.

msdeploy -verb:dump -source:appPoolConfig=DefaultAppPool -xml


msdeploy -verb:sync -source:appPoolConfig -dest:appPoolConfig=DefaultAppPool,computerName=Server2

* Tip: Use the -xml flag when dumping for more info or you just get paths.

archiveDir

auto

cert

comObject32

comObject64

contentPath

createApp

dbMySql

filePath

Returns file path of -source argument, or syncs -source to -dest.

gacAssembly

iisApp

* Ref: (http://bit.ly/A0WFVC)[http://bit.ly/A0WFVC]

Dumps contents of web app (eg: 'MySite/MyApp'), or syncs -source to -dest.

Useful when you wan to retrieve content, without certs, assemblies, or IIS config data.

msdeploy -verb:sync -source:iisApp=c:\Contoso -dest:iisApp="Site1/ContosoApp"

machineConfig32

machineConfig64

manifest

Enables specification of a custom manifest file containing a list of other providers to be executed in the order listed in the manifest.

The provider input is a path of a single file that contains the manifest (for example, c:\manifest.xml).

msdeploy -verb:sync -source:manifest=c:\MyManifest.xml -dest:manifest=c:\MyManifest.xml,computerName=Server1

msdeploy -verb:dump -source:manifest=c:\CustomManifest.xml

msdeploy -verb:sync -source:manifest=c:\CustomManifest.xml -dest:manifest=c:\CustomManifest.xml,computerName=Server1

metaKey

package

Used by the *.bat file of a WebDeploy package to deploy a package to the target folder:

msdeploy -verb:sync -source:package="C:\MyPackage.zip" -dest:auto

The following is an example of what's invoked during a WebDeploy expansion:

msdeploy.exe 
  -verb:sync 
  -source:package='C:\TMP\XAct.Spikes.A.zip' 
  -dest:auto,includeAcls="False" 
  -disableLink:AppPoolExtension 
  -disableLink:ContentExtension 
  -disableLink:CertificateExtension 
  -setParamFile:"C:\TMP\WEBDEPLOY\Packages\XAct.Spikes.A.SetParameters.xml"  
  -whatif

regKey

regValue

rootWebConfig32

rootWebConfig64

runCommand

setAcl

* Ref: http://bit.ly/A4jNMC

msdeploy.exe -verb:dump -source:setacl="Default Web Site" -xml


msdeploy.exe -verb:sync –source:setacl -dest:setacl="c:\MyDir",setAclUser=NetworkService,setAclAccess=Write

#### webServer

webServer60

recylceApp

Stops the AppPool (all page requests then return 503's…):

msdeploy.exe -verb:sync -source:recycleApp -dest:recycleApp="Default Web Site/myapp",recycleMode="StopAppPool"

Restarts an appPool. Very useful:

msdeploy.exe -verb:sync -source:recycleApp -dest="RemoteSite1/MyRemoteApp",computername=RemoteServer1

MSDeploy Flags

Web Deploy operation settings are non-provider specific command-line flags. They modify all of a Web Deploy operation.

The most common you will see are the -verb, -source, -dest, sometimes -xml, and -whatif and in non-prod environments -allowUntrusted

Common Settings

Providers have a set of common provider settings:

Manifest File

<sitemanifest>
  <appHostConfig path="mySite" />
  <gacAssembly path="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  <comObject path="Microsoft.ApplicationHost.AdminManager" />
  <contentPath path="c:\source" />
  <regKey path="HKLM\Software\ODBC" />
</sitemanifest>

Example:

..\obj\Debug\Package>msdeploy -verb:dump -source:apphostconfig="Bwainz.com",computername=192.168.0.2,userName=Administrator,password=Passw0rd1

Examples

//On server (won't be allowed from client, as no auth info), brings back a huge list:
msdeploy -verb:dump -source:appHostConfig

BAT FILE DEPLOYMENT

If you can't get VS to deploy, you can use the command line bat file:

`XAct.Apps.WebSite.Bwainz.deploy.cmd /Y /U:"XACT-WS2K8-02\Administrator" /P:"Ttpitk2ss" /M:bwainz.com`

* You have to use either \T (WhatIf) of \Y (Proceed) * Have to provide Auth username (full server domain) and password * You have to provide sitename with \M


Further Reading