3

I want to deploy my webjob ( dotnet core 2.0 commandline application ) through 'release' defination. My drop folder contains webjob named 'MyWebjob.zip'. I want to copy this to my webapps below directory where all tasks exists

D:\home\site\wwwroot\App_Data\jobs\continuous>

Below is snap of of my existing release defination

enter image description here

Can anyone tell which copy job is suitable to copy contents from drop folder to 'wwwroot\App_Data\jobs\continuous' direcotry?

Or is there any easy way to deploy webjob ( dotnet core 2.0 ) using VSTS?

Note: I can't use FTP for some reason as 'Continuous Integration' is enabled for our project.

user2243747
  • 2,767
  • 6
  • 41
  • 61

2 Answers2

3

You can’t use these tasks to deploy webjob.

If you remain the folder structure (App_Data\jobs\continuous) in MyWebjob.zip file, you can deploy it to azure web app through Azure App Service Deploy task (App type: Web App; App Service name:[your app service]; Package or folder:[that zip file]; Check Publish using Web Deploy option).

Otherwise, I recommend that you can do it through Extract files and Copy files to organize the folder structure, then deploy through Azure App Service Deploy task (Package or folder:[App_Data parent folder]; Uncheck Publish using Web Deploy option).

You also can upload files through Kudu API (Extract zip file through Extract files task first)

There are some threads that can help you to call Kudu API in VSTS.

Remove files and foldes on Azure before a new deploy from VSTS

How to access Kudu in Azure using power shell script

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
2

You can add a custom target to your worker .csproj file.

  <Target Name="UpdateWebJobsPublishDir" BeforeTargets="ComputeFilesToPublish">
    <PropertyGroup>
      <PublishDir>$(PublishDir)App_Data/jobs/continuous/$(ProjectName)/</PublishDir>
    </PropertyGroup>
  </Target>

The above vill update the output dir before it is publised. In VSTS/Azure DevOps you just deploy you project as normal webapp it will be put in the right folder.

dzed
  • 524
  • 8
  • 13