I have tried to create two different zip for each project by adding two vsBuild tasks.

While writing my yaml based pipeline I am facing two issue:-

  1. In webjob project path is DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\App_Data\jobs\continuous\somethingApp.zip" but nothing is getting added into it.

2 When I am deploying it azure app service, during deployment of my web app I am facing below error:

at ExecState._setResult (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.179.0\node_modules\azure-pipelines-task-lib\toolrunner.js:828:25)
    at ExecState.CheckComplete (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.179.0\node_modules\azure-pipelines-task-lib\toolrunner.js:811:18)
    at ChildProcess.<anonymous> (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.179.0\node_modules\azure-pipelines-task-lib\toolrunner.js:733:19)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:920:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)

Hence not able deploy anything although Pipeline completing successfully.

3

There are 3 best solutions below

0
Mukeem Ahmed On BEST ANSWER

Basically there are two possible solutions for the situation in which you are supposed to deploy web api and webjob .NET CORE projects to azure webapp service:-

  1. If you are using VSBuild task to build you solution then simply build your both projects and create zip file for your deployable webApi project and before publishing your drop artifact, make sure you copy webjob projects build file(.dll etc) into artifactstagingDirectory in in the format as 'App_Data\jobs\continuous(or triggered)\yourFiles' and then deploy your artifact to azure app service. Hope this should work.

  2. While the other way of doing this is, Build your DOTNET Core projects using DOTNETCORECLI task do in below way

    `

  • task: DotNetCoreCLI@2 inputs: command: 'publish' publishWebProjects: true arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)\yourwebApiProjectName.zip'

    - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        publishWebProjects: false
        projects: '**/yourWebJobProjectName.csproj'
        arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)\App_Data\jobs\continuous\yourWebJObName'
        zipAfterPublish: false
        modifyOutputPath: false
    
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'drop'
        publishLocation: 'Container'`
    

Then you can deploy this artifact at your azure app service. Hope this will resolve issue related to deployment of DOTNET Core based webjob and webapi project at azure web app service.

0
Jason Pan On

The key to the problem, I think it should be a path configuration problem, unable to access your webjob application.

So I suggest you create a virtual application in portal.

enter image description here

For more details, you can refer to this blog. If you need further help, please let me know.

How to publish webjob from azure devops to azure app service using Azure app service deploy task

0
Vito Liu On

but nothing is getting added into it

If you just add below MSBuild Arguments in your vsBuild task, then it will create the zip file and save output file in the zip file

/p:WebPublishMethod=Package /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\App_Data\jobs\continuous\somethingApp.zip"