MS Deploy Basics
Microsoft release RC1 of its new web deployment tool called MS Deploy a few days ago and I have been playing around with it. Here is a quick summary and reference of the basic commands to help you get started.
Command-Line Syntax
-source:<provider>[=<pathToProviderObject>
[,<providerSetting>=<providerSettingValue>]]
[-dest:<provider>[=<pathToProviderObject>
[,<providerSetting>=<providerSettingValue>]]
]
[-<MSDeployOperationSetting> ...]
Verbs
Verbs determine the action to completed on the source or destination object. The most common used verbs are listed below.
- 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 of dependencies that exist on the source machine and would need to be installed on the target machine
Providers
Providers handle specific source and destination objects. The source and destination objects must be of the same type unless you are using the archiveDir provider to restore or create archives. The current providers are listed below
- appHostConfig
- appHostSchema
- appPoolConfig
- archiveDir
- auto
- cert
- comObject32
- comObject64
- contentPath
- dbFullSql
- dbMySql
- gacAssembly
- iisApp
- machineConfig32
- machineConfig64
- manifest
- metaKey
- package
- regKey
- regValue
- rootWebConfig32
- rootWebConfig64
- setAcl
- webServer
- webServer60
Examples
Scenario 1: Sync IIS Objects Between Machines
There are two providers that can be used to sync IIS objects.
IIS 7.0
- Web site
- appHostConfig provider
- Web Server
- webServer provider
IIS 6.0
- Web site
- metaKey provider
- Web Server
- webServer60 provider
When migrating from IIS 6.0 to IIS 7.0, use the IIS 6.0 providers.
Web Site
Sync Web Site from IIS 7.0 to IIS 7.0
The above command will log the changes needed to sync up with the sourcemachine. The –whatif command is used to run the command without making the actual changes.
msdeploy -verb:dump -source:apphostconfig="Default Web Site",computername=sourcemachine -xml
You can also use the dump command to see the output. Add the –xml option to output the dump as xml. Finally, make sure the machine you are calling out to has the remote service (Web Deployment Agent Service) running.
Sync Web Site from IIS 6.0 to IIS 6.0
A tool called metabase explorer can help you determine the metaKey for a site.
Migrate Web Site from IIS 6.0 to IIS 7.0
Web Server
Sync Web Server from IIS 7.0 to IIS 7.0
Sync Web Server from IIS 6.0 to IIS 6.0
Migrate Web Server from IIS 6.0 to IIS 7.0
Scenario 2: Sync GAC Objects Between Machines
The above command will log the output of syncing the Test.Assembly GAC dll from the sourcemachine.
Scenario 3: Sync COM objects Between Machines
The above command will log the output of syncing the Test.COM dll from the sourcemachine
Scenario 4: Sync Content Between Machines
The above command will log the output of syncing files from a directory on the sourcemachine to a directory on the target machine. The contentPath accepts the follow arguments
- Directory path
- C:\Inetpub
- File path
- C:\Inetpub\default.aspx
- Site path
- “Default Web Site”
- Application path
- “Default Web Site/App1”
Scenario 5: Pulling It All Together Into A Manifest
Using a manifest allows you to configure multiple providers in an xml file and executed them in the order they are listed. Below is an example of what the manifest might look like to complete scenarios 1-3.
<appHostConfig path="Default Web Site" />
<gacAssembly path="Test.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2eds8d236nhbbf786k" />
<comObject32 path="Test.COM" />
</site>
Below is the command used to execute the manifest to sync the changes from the sourcemachine to the machine it’s executed on.
Scenario 6: Replace Rule
Here is an example of replacing the path of a web site to a different path on the target machine when syncing across machines.
Running a dump –xml will help you identify what values you need to replace. Some more examples can be found here.
Finally, for a more detailed reference of MS Deploy go here.
Similar Posts
- Using VSDBCMD and MSBUILD to Build and Deploy DBPro Projects
- Using MS Deploy Instead of the Copy Command In MSBuild
- Team Foundation Server Build Notification Screen
