简体   繁体   English

Azure DevOps / 多个项目

[英]Azure DevOps / Multiple projects

I'm trying to get CICD ready using Azure DevOps.我正在尝试使用 Azure DevOps 准备好 CICD。 I have a big repo with 1 webapp, 2 azure functions and some others projects used as librairies.我有一个很大的回购协议,其中包含 1 个 Web 应用程序、2 个 azure 函数和其他一些用作库的项目。 So I have 3 project to deploy, on different environnements.所以我要在不同的环境中部署 3 个项目。

I have only 1.sln file, at the root of these projects.在这些项目的根目录下,我只有 1.sln 文件。

I'm able to build all the projects, but I don't know how to get 1 particular built project (artifact?) and deploy it.我能够构建所有项目,但我不知道如何获取 1 个特定的构建项目(工件?)并进行部署。

- task: VSBuild@1
  inputs:
    solution: 'allproject.sln'
- task: PublishBuildArtifacts@1

I tried this, and I'm able to deploy the artifact on my release pipeline but when I have only one project built.我尝试了这个,并且我能够在我的发布管道上部署工件,但是当我只构建了一个项目时。 Here I don't know how to procede.在这里我不知道如何进行。

Splitting my projects and create solution for each projects is a possibility, but if possible I would avoid this.拆分我的项目并为每个项目创建解决方案是可能的,但如果可能的话,我会避免这种情况。 Use MSBuild is possible too but I really want to avoid it because of the complexity (in the maintenance of the pipelines, we are a small team).使用 MSBuild 也是可能的,但我真的想避免它,因为它很复杂(在管道维护方面,我们是一个小团队)。


After GeralexGR awesome answer, I solved some of my problems but I cant solve the publication of the artifacts.在 GeralexGR 出色的回答之后,我解决了一些问题,但我无法解决工件的发布。

Here a screenshot of my problem这是我的问题的截图

So I want to publish functionApp on the function app env, but I cant choose the artifact on the publication interface.所以想在function app env上发布functionApp,但是在发布界面无法选择神器。 Any idea?任何的想法?

I have created a solution based on your description.我已经根据您的描述创建了一个解决方案。 In this setup I included a consoleApp and two functions apps inside the functions folder as shown below.在此设置中,我在 functions 文件夹中包括了一个 consoleApp 和两个函数应用程序,如下所示。

项目层级

You can build your project as you could do on visual studio and each project will contain the output bin and obj folders with the artifact.您可以像在 visual studio 上那样构建您的项目,每个项目都将包含 output bin 和 obj 文件夹以及工件。

构建 azure devops

You should then decide your strategy regarding how you should proceed.然后你应该决定你应该如何进行的策略。 For example you could upload all ArtifactsStagingDirectory or each folder separate.例如,您可以上传所有 ArtifactsStagingDirectory 或单独的每个文件夹。

YAML pipeline: YAML 流水线:

trigger:
- none

pr: none 

pool:
  vmImage: ubuntu-latest

steps:

- task: UseDotNet@2
  inputs:
    packageType: sdk
    version: '6.0.x'
    includePreviewVersions: true
    
- task: DotNetCoreCLI@2
  displayName: Building .NET project
  inputs:
    command: 'build'
    projects: '**/*.csproj'
    arguments: '--configuration debug'

Test step to locate the structure:定位结构的测试步骤:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      # Write your PowerShell commands here.
      
      cd "$(Pipeline.Workspace)/s"
      ls

Inside functions and consoleapp projects you can locate the build artifacts.在函数和控制台应用程序项目中,您可以找到构建工件。

测试步骤

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM