title: WebJob doesn't work when splitting pipeline into build and release
body: <p>I'm trying to deploy a WebJob using Azure DevOps. I have the following pipeline:</p>
  <pre><code>pool:
  
  #  name: Hosted Windows 2019 with VS2019
    vmImage: windows-2019
  
    demands:
    - msbuild
    - visualstudio
    - vstest
  
  variables:
      BuildPlatform: 'any cpu'
      BuildConfiguration: 'release'
      Parameters.solution: '**\*.sln'
  
  steps:
  
  - task: UseDotNet@2
    displayName: 'Use Net Core 3.1.0'
    inputs:
  #    packageType: 'runtime' # Options: runtime, sdk
      packageType: 'sdk'
      version: '3.1.100'
  
  - task: NuGetToolInstaller@1
    displayName: 'Use NuGet 5.7.0'
    inputs:
      versionSpec: 5.7.0
  
  - task: NuGetCommand@2
    displayName: 'NuGet restore'
    inputs:
      restoreSolution: '$(Parameters.solution)'
  
  - task: DotNetCoreCLI@2
    displayName: 'net build'
    inputs:
      command: 'build'
      projects: '**\*.csproj'
      arguments: '--configuration Release'
  
  - task: DotNetCoreCLI@2
    displayName: 'net publish'
    inputs:
      command: 'publish'
      publishWebProjects: false
      projects: '**\*.csproj'
      arguments: '--output $(Build.ArtifactStagingDirectory)\WebJob\App_Data\jobs\continuous\WJ_Channel_Fetch'
      zipAfterPublish: false
      modifyOutputPath: false
  
  - task: PowerShell@2
    inputs:
      targetType: 'inline'
      script: '&quot;dotnet WJ_Channel_Fetch.dll&quot; | Out-File run.cmd -Encoding ASCII; $LASTEXITCODE'
      errorActionPreference: 'stop'
      failOnStderr: false
      ignoreLASTEXITCODE: false
      pwsh: false
      workingDirectory: '$(Build.ArtifactStagingDirectory)\WebJob\App_Data\jobs\continuous\WJ_Channel_Fetch'
  
  - task: AzureAppServiceManage@0
    displayName: 'Stop Azure App Service: XXXX-pipelines2'
    inputs:
      azureSubscription: 'Visual Studio Professional (**********)'
      Action: 'Stop Azure App Service'
      WebAppName: 'XXXX-pipelines2'
  
  - task: AzureRmWebAppDeployment@3
    displayName: 'Azure App Service Deploy: XXXX-pipelines2'
    inputs:
      azureSubscription: 'Visual Studio Professional (**********)'
      WebAppName: 'XXXX-pipelines2'
      Package: '$(Build.ArtifactStagingDirectory)\WebJob'
      TakeAppOfflineFlag: true
  
  - task: AzureAppServiceManage@0
    displayName: 'Start Azure App Service: XXXX-pipelines2'
    inputs:
      azureSubscription: 'Visual Studio Professional (**********)'
      Action: 'Start Azure App Service'
      WebAppName: 'XXXX-pipelines2'
  
  - task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: drop'
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: 'drop'
      publishLocation: 'Container'
    condition: succeededOrFailed()
  </code></pre>
  <p>This works perfect, but I want to move the deploy part to a Release pipeline, so I can make use of the approvals between environments (DEV, QA, TEST, PROD).</p>
  <p>The problem is that when I move it to a Release pipeline, the WebJob is deployed but it appears to be in an inconsistent state. I can't stop it, nor delete it; the only way to get rid of it is by deleting the WebApp.
  If I use only the YAML from above everything works.</p>
  <p>This is my Release pipeline:</p>
  <p><a href="https://i.stack.imgur.com/hES27.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hES27.png" alt="enter image description here" /></a></p>
  <p>Any ideas? Many thanks in advance!</p>