在 Azure DevOps 发布定义中部署来自同一项目的多个 WebJobs? [英] Deploying Multiple WebJobs from the Same Project in a Azure DevOps Release Definition?

本文介绍了在 Azure DevOps 发布定义中部署来自同一项目的多个 WebJobs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我们构建代码的方式是我们的解决方案中有多个项目,每个项目都有多个 webjob.我们已经配置了使用 run.cmd 文件发布这些多个 webjob 的手动方式,并将相关的 run.cmd 文件复制到根文件夹,具体取决于我们尝试发布的 webjob.

So the way that we've structured our code is that we've got several projects in our solution that each have multiple webjobs. We've configured a manual way of releasing these multiple webjobs using the run.cmd files and copying over the pertinent run.cmd file to the root folder depending on which webjob we're trying to release.

我想知道是否有任何方法可以通过 Azure DevOps 中的构建/发布定义来做到这一点,而不必将多个 webjob 拆分为单个项目.这些多个 webjob 也都位于同一个应用服务中.

I'm wondering if there is any way to do this via a build/release definition in Azure DevOps without having to tear apart the multiple webjobs into individual projects. These multiple webjobs also all live in the same App Service.

推荐答案

你所做的是目前最简单的方法,你可以在 Azure DevOps Build/Release Pipeline 中克隆这个过程.在 Azure DevOps 中没有任何方法可以做到这一点,而不必将多个 webjobs 拆分为单独的项目.

What you have done is the simplest way at present, you could just clone the process in Azure DevOps Build/Release Pipeline. There is not any way to do this in Azure DevOps without having to tear apart the multiple webjobs into individual projects.

我们已经配置了手动发布这些多个 webjobs 的方式使用 run.cmd 文件并将相关的 run.cmd 文件复制到根文件夹取决于我们尝试发布的 webjob.

We've configured a manual way of releasing these multiple webjobs using the run.cmd files and copying over the pertinent run.cmd file to the root folder depending on which webjob we're trying to release.

例如,在您的构建解决方案步骤中定义(添加一些复制文件步骤以复制必要的文件):-

For example, in your build solution step define (add some copy file step to copy necessary files) :-

  1. Visual Studio Build(解决方案:***.sln,MSBuild 参数:/p:DeployOnBuild=true/p:WebPublishMethod=包/p:SkipInvalidConfigurations=true/p:PackageLocation="$(build.artifactstagingdirectory)")

  1. Visual Studio Build (Solution: ***.sln, MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)")

发布构建工件(发布路径:$(build.artifactstagingdirectory);工件名称:drop;工件类型:服务器)

Publish Build Artifacts (Path to Publish: $(build.artifactstagingdirectory); Artifact Name: drop; Artifact Type: Server)

为此构建定义创建发布定义并添加任务

Create a release definition for this build definition and add a task

  1. Azure 应用服务部署
  2. 选择您的 Azure 订阅和应用服务名称;
  3. 选择您的包或文件夹:$(System.DefaultWorkingDirectory)**WebJob1.zip

您可以类似地为 WebJob2.zip 创建另一个 Azure 应用服务部署任务,并通过单个构建和发布管道部署任意数量的 Web 作业.

You can similary create another Azure App Service Deploy task for WebJob2.zip and deploy as many webjobs you want through a single build and release pipeline.

这篇关于在 Azure DevOps 发布定义中部署来自同一项目的多个 WebJobs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆