Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet core 2.0 webjob deployment - VSTS

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.

like image 910
user2243747 Avatar asked Jan 17 '26 10:01

user2243747


2 Answers

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

like image 114
starian chen-MSFT Avatar answered Jan 20 '26 23:01

starian chen-MSFT


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.

like image 38
dzed Avatar answered Jan 20 '26 23:01

dzed