Build Solution
的构建类似于steps:
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation="$(build.artifactstagingdirectory)\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
>
默认的
Publish Artifact
是:steps:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
我想用2个工件做一些事情(这不起作用):
steps:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: webapi'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)\MVCProject\bin$(BuildConfiguration)\netcorapp2.2'
ArtifactName: webapi
condition: succeededOrFailed()
steps:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: angular'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)\MVCProject\clientapp\dist'
ArtifactName: angular
condition: succeededOrFailed()
我缺少什么/正确/更好的方法是什么。
(从项目中移出角度并不能解决此问题,我们还没有准备好为此)
#1 楼
这是我针对单一构建中的多个工件的YAML。pool:
name: Hosted Windows 2019 with VS2019
demands:
- msbuild
- visualstudio
- vstest
- npm
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: VSBuild@1
displayName: 'Build solution WebApi'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArchitecture: x64
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: WebApi'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'dotnet-webapi'
condition: succeededOrFailed()
- task: DeleteFiles@1
displayName: 'Delete build.artifactstagingdirectory for Angular'
inputs:
SourceFolder: '$(build.artifactstagingdirectory)'
Contents: '**'
- task: Npm@1
displayName: 'npm install'
inputs:
workingDir: project/ClientApp
verbose: false
- task: Npm@1
displayName: 'npm run prod-build'
inputs:
command: custom
workingDir: project/ClientApp
verbose: false
customCommand: 'run prod-build'
- task: Npm@1
displayName: 'npm run dev-build'
inputs:
command: custom
workingDir: project/ClientApp
verbose: false
customCommand: 'run prod-dev'
enabled: false
- task: CopyFiles@2
displayName: 'Copy Angular/Dist to build.artifactstagingdirectory'
inputs:
SourceFolder: project/ClientApp/dist/ClientApp
Contents: |
**
!config.json
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Angular'
inputs:
ArtifactName: angular
评论
在发布管道中,您将如何指定要使用的Build Artifact?
– Dbloom
20年10月10日,0:19
@Dbloom当您在发布管道任务中选择文件夹/档案/软件包时,这两种工件均可用。因此,我只选择正确发布任务所需的那个。
– Erik Philips
20年7月8日在22:10
评论
你解决了吗?我遇到了类似的决定。 FWIW我走了另一条路,那就是:带有多个包的单个工件。我遇到了各种各样的问题,因为这似乎使发布管道感到困惑,而且任何人都在猜测将哪个应用程序部署在哪里...@StePammenter是的(最终)。回答传入。
感谢您回来。事实证明,我的错是复制相同的Azure函数设置,而不是管道本身!