我有一个包含几个项目的 Visual Studio 解决方案,但我的构建管道仅发布一个项目

我有一个包含几个项目的 Visual Studio 解决方案,但我的构建管道仅发布一个项目

我正在尝试创建 CI/CD,但只得到一个工件。我得到的工件是客户端应用程序(Blazor 应用程序)。我的解决方案结构如下:

-src

--API

- 核

- 领域

--用户界面

这些是 VS 中的虚拟地图。在构建阶段,所有项目都会被构建。

这是 YAML:

trigger:
- develop

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  package-version: '1.2.6'
  dotNetFramework: 'net6.0'
  dotNetVersion: '6.0.x'
  targetRuntime: 'linux-x64'
  azureSubscription: 'TestResources'

stages:
- stage: Build

  jobs:
    - job: build
     
      steps:
      - task: UseDotNet@2
        displayName: 'Use .NET 6 sdk'
        inputs:
          packageType: 'sdk'
          version: $(dotNetVersion)
          includePreviewVersions: true
              
      - task: DotNetCoreCLI@2
        displayName: Build solution
        inputs:
          command: 'build'
          projects: '**/*.sln'
          arguments: '--configuration $(buildConfiguration)'

      - task: DotNetCoreCLI@2
        displayName: Run unit tests
        inputs:
         command: 'test'
         projects: '**/*Tests/*.csproj'
         arguments: '--configuration $(buildConfiguration)'

- stage: Development
  displayName: 'Deploy to Dev'
  dependsOn: [ Build ]
  condition: succeeded()
  variables:
  - group: Apep

  jobs:
    - job:  DeployToDevelopment
      displayName: 'Deploy Development'
      variables:
        sqlFile: '$(Build.SourcesDirectory)/SQL/sqlscript.sql'
        
      steps:
         
      # Publish it as .NET 6 self-contained application for linux runtime
        - task: DotNetCoreCLI@2
          inputs:
            command: publish
            #publishWebProjects: false
            #arguments: '--configuration $(BuildConfiguration) --framework $(dotNetFramework) --runtime $(targetRuntime) --self-contained --output $(Build.ArtifactStagingDirectory)'
            zipAfterPublish: True
            projects: '**/*.sln'

        # Package the file and uploads them as an artifact of the build
        - task: PublishPipelineArtifact@1
          inputs:
            targetPath: '$(Build.ArtifactStagingDirectory)'
            artifact: 'drop'
            publishLocation: 'pipeline'
          

我尝试将项目参数定位到仅针对一个项目,但它一直在构建我的客户端应用程序(Blazor 应用程序)。

相关内容