What does the default Kudu deploy.cmd for ASP.NET Web Apps do at the
msbuild stage of deployment?
First, Kudu will check whether we have set the
%IN_PLACE_DEPLOYMENT% environmental variable to
1. If we have not set it to
1, Kudu will do the default deployment. Otherwise, Kudu will do an in place deployment.
From looking at the
if... else... statement during the
msbuild stage of deployment, the default deployment differs from an in place deployment build in two ways:
- The default deployment passes
/t:pipelinePreDeployCopyAllFilesToOneFolderoption. While I haven't found official documentation, I assume this means that
msbuildputs the build results into a temporary folder as an intermediate step before running Kudu Sync.
- The default deployment also specifies
PackageTempDir="%DEPLOYMENTTEMP%";as the directory that stores the build results before Kudu Sync copies them to the deployment directory.
In other words, the default deployment adds a step that the in place deployment does not have. It looks something like this:
- msbuild -> to -> Temp Directory -> KuduSync -> to Destination Directory
Here is a list of what the deploy.cmd file does at the
msbuild stage. As mentioned above, it first checks whether were doing an in place deployment.
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
This is the default deployment.
call :ExecuteCmdRun the subroutine at the the
ExecuteCmdlabel, passing it all of the following as parameters.
"%MSBUILDPATH%"Specify the path to the
"%DEPLOYMENTSOURCE%\MyWebApp\MyWebApp.csproj"Specify the location of our
csprojfile, which contains the targets that
/nologoDon't output the banner or copyright to the command window.
/verbosity:mOnly output minimal information in the build log.
msbuildto run the
Buildtarget. A target is a group of tasks; we can instruct
msbuildto run one or more groups of tasks or targets.
msbuildalso to run this particular, poorly documented build task, that we explained above in this blog post.
msbuildsome more properties.
_PackageTempDir="%DEPLOYMENTTEMP%";Specify the directory to which
msbuildshould save build results before it uses KuduSync to copy them to the destination directory.
AutoParameterizationWebConfigConnectionStrings=false;Don't tokenize the connection string.
Configuration=ReleaseBuild the release (as opposed to the debug) configuration.
/p:SolutionDir="%DEPLOYMENTSOURCE%.\"Pass the directory that contains our
%SCMBUILD_ARGS%Allow for us to use environmental variables to pass
This is the in place deployment. Kudu will run almost the exact same
msbuild command, but will leave out two options.
call :ExecuteCmd "%MSBUILDPATH%"
- --- this instruction is missing from the in place deployment ---
- --- this instruction is also missing from the in place deployment ---
Follow Up Question
Why would we elect to do an in place deployment?