IT:AD:WebDeploy:HowTo:Create a Package From The CLI
Summary
Using Visual Studio's button to create a package is fine for simple developer scenarios.
But not how one would do it from within a IT:AD:Continuous Integration scenario.
Process
Use IT:AD:MSBuild to invoke IT:AD:MSBuild targets within:
* %ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets
- and this file in turn imports
* %ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets
msbuild {solution file}
/p:CreatePackageOnPublish=[true|false]
/p:DeployOnBuild=true
/p:DeployTarget=[MsDeployPublish|Package]
# define the publish scenario to use
/p:PublishProfile='Test.pubxml'
#leave files on server after deployment
/p:SkipExtraFilesOnServer=[true|false]
/p:DeployIisAppPath=<Web Site Name>/<Folder>
/p:MsDeployServiceUrl=Location of MSDeploy installation you want to use
# do not use the older RemoteAgent - stick with WMSVC
# http://stackoverflow.com/questions/2636153/how-can-i-get-tfs2010-to-run-msdeploy-for-me-through-msbuild
/p:MsDeployPublishMethod=[WMSVC|File|InProc]
# used with self-signed SSL certificates:
/p:AllowUntrustedCertificate=[true|false]
/p:UserName
/p:Password
/p:DeployIisAppPath=staging.example.com
/p:MsDeployServiceUrl=https://staging.example.com:8172/msdeploy.axd
/p:IncludeIisSettingsOnPublish=[false|false]
Creating just a Package
In other words – to create a package, without deploying:
msbuild {solution file}
/p:CreatePackageOnPublish=true
/p:DeployOnBuild=true
# define the publish scenario to use
/p:PublishProfile='Test.pubxml'
/p:DeployTarget=MsDeployPublish
Note:This only works if you have actually added to the Test.pubxml Publish Profile a WebDeploy Package (and not a WebDeploy)
Creating and Deploying a Package
msbuild {solution file}
/p:CreatePackageOnPublish=true
/p:DeployOnBuild=true
/p:DeployTarget=Package
# define the publish scenario to use
/p:PublishProfile='Test.pubxml'
Note:This only works if you have actually added to the Test.pubxml Publish Profile a WebDeploy Package (and not a WebDeploy)
Creating and Deploying a Package to a new Site
msbuild {solution file}
/p:CreatePackageOnPublish=true
/p:DeployOnBuild=true
/p:DeployTarget=Package
# define the publish scenario to use
/p:PublishProfile='Test.pubxml'
/p:PublishIISAppPath="Default Web Site/Test 6"
will create a new Virtual directory (test 6) under the web site.
Note:This only works if you have actually added to the Test.pubxml Publish Profile a WebDeploy Package (and not a WebDeploy)
Creating it from a Project (not a Solution)
If you want to build a project's package:
msbuild {project file} /t:Package