title: kudu custom deployment fails for asp.net core webapp
body: <p>I use pretty much standard custom kudu deployment script for asp.net core web app for external git deployment.
  I managed to run the script mostly successfully, through mingling with SCM_COMMAND_IDLE_TIMEOUT and .cmd files encoding. My deployment scripts look as follows:</p>
  
  <p>.deployment</p>
  
  <pre><code>[config]
  command = deploy.cmd
  </code></pre>
  
  <p>deploy.cmd</p>
  
  <pre><code>@echo off
  IF "%WEBSITE_SITE_TYPE%" == "&lt;project_name&gt;" (
      .\&lt;project folder&gt;\Properties\deploy.cmd
      goto end
  )
  
  echo Unknown WEBSITE_SITE_TYPE: "%WEBSITE_SITE_TYPE%". Expected one of the "&lt;project name&gt;"
  
  :end
  exit /b
  </code></pre>
  
  <p><code>.\&lt;project folder&gt;\Properties\deploy.cmd</code> - regular asp.net core deploy.cmd script, updated for proper folder structure.</p>
  
  <p>The WEBSITE_SITE_TYPE is a custom environment variable I added to the web app.
  All these scripts saved with utf-8 without BOM encoding.</p>
  
  <p>But even though the scripts look like runs successfully, the final state of the deployment process is Failed.</p>
  
  <p>When looking into the kudu deployment log last few lines of the log look as follows:</p>
  
  <pre><code>...
  2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\runtime.ec2944dd8b20ec099bf3.js',,0
  2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\styles.8ef9ef86d2a54ed3748c.css',,0
  2018-10-14T20:50:51.0816988Z,Deleting app_offline.htm,,0
  2018-10-14T20:50:51.0816988Z,Finished successfully.,,0
  2018-10-14T20:50:51.1129431Z,\r\nD:\Program Files (x86)\SiteExtensions\Kudu\78.11002.3584\bin\Scripts\starter.cmd deploy.cmd,,2
  </code></pre>
  
  <p>Apparently the last line returns error code 2 and it might cause the script status to fail. But what does it mean and how do I fix it?</p>