Azure DevOps YAML-dotnet核心CLI包可生成其他项目 [英] Azure DevOps YAML - dotnet core CLI pack builds additional projects
问题描述
我正在尝试打包几个软件包,但是--no-build参数或选项被忽略,并且正在构建包括测试项目在内的多个项目。
I'm trying to pack several packages, however the --no-build argument or option is being ignored and several projects including test projects are being built.
我尝试过使用 NoBuild的不同组合,但是由于某些原因总是引用额外的项目,我如何打包而不进行构建或打包使用其他项目?
I have tried different combinations on using "NoBuild" but for some reason extra projects are always referenced, how can i pack without build or using additional projects in pack?
主要YAML :
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- develop
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
storeBuildNumber: $(Build.BuildNumber)
NugetVersion: '1.1.0-unstable'
steps:
- template: AzureDevOps/Templates/provision-template.yml
parameters:
projects: |
**/ProjectA.csproj
**/ProjectB.csproj
模板YAML:
parameters:
projects: ''
steps:
- task: DotNetCoreCLI@2
displayName: "ProvisionRestoreProjects"
inputs:
command: 'restore'
projects: ${{ parameters.projects }}
arguments: >
-s "http://MyFeed/nuget/Feed-feature-yaml/"
-k "ASDF3234234SDSD"
- task: DotNetCoreCLI@2
displayName: "ProvisionBuildProjects"
inputs:
command: 'build'
projects: ${{ parameters.projects }}
arguments: '--configuration release --no-cache'
- task: DotNetCoreCLI@2
displayName: "ProvisionPackProjects"
inputs:
command: 'pack'
nobuild: true
projects: ${{ parameters.projects }}
versioningScheme: 'byEnvVar'
versionEnvVar: 'NugetVersion'
arguments: '--no-build'
- task: DotNetCoreCLI@2
displayName: "ProvisionPushProjects"
inputs:
command: custom
custom: nuget
arguments: >
push "$(Build.ArtifactStagingDirectory)\*.nupkg"
-s "http://MyFeed/nuget/Feed-feature-yaml/"
-k "ASDF3234234SDSD"
推荐答案
我刚刚遇到了这个问题。我的解决方法是使用自定义命令,其中的管道注入效果不佳,这意味着默认值。
I have just encountered this. My workaround was to use a custom command where the pipeline doesn't inject well meaning defaults.
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: 'custom'
custom: 'pack'
arguments: 'path/to/project.csproj --no-build --include-symbols --include-source -c=Release -o $(build.artifactstagingdirectory)'
这仍然让您弄清楚如何覆盖软件包版本。
This still leaves you figuring out how to override the package version.
这篇关于Azure DevOps YAML-dotnet核心CLI包可生成其他项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!