Thursday, September 15, 2011

Deploying ASP web application with command line msdeploy without deleting all files on server

.
This mimicks the IIS wizard prompt "No, just append the files in the application package to the destination" on the "Overwrite Existing Files" panel. I used the "-enableRule:DoNotDeleteRule" for msdeploy.exe to accomplish this.


First, Use "Package" option within Visual Studio 2010 or via MSBuild.exe on the command line. This produces a "MyApp.deploy.cmd" along with a matching "MyApp.SetParameters.xml" that goes with your MyApp.ZIP file.

Then, simply invoke the CMD file to deploy the application using the "enableRule" parameter.

C:\>call MyApp.deploy.cmd /Y /m:myhost /u:my_user /p:my_password -enableRule:DoNotDeleteRule -debug -setParamFile:C:\MyPath\MyApp.SetParameters.xml

This will prevent configuration files such as web.config from being deleted as it deploys the application over top of the previous installation.

This has a few assumptions:
  1. You've already gone through the whole set of configuration plumbing needed to set up the MSDeploy command to properly work for remotely deploy the application to IIS server. 
  2. You already have things working such that you can deploy the ZIP file using IIS manager with Deploy > Import Application and stepping through the wizard.

No comments:

Post a Comment