我正在尝试打包几个软件包,但是--no-build参数或选项被忽略,并且正在构建包括测试项目在内的多个项目。
我在使用“ NoBuild”时尝试了不同的组合,但是由于某些原因,总是引用额外的项目,如何在不构建或不打包的情况下打包?
主要YAML:
)$
模板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
答案 0 :(得分:0)
我刚遇到这个。我的解决方法是使用自定义命令,管道不能很好地注入,这意味着使用默认值。
- 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)'
这仍然让您弄清楚如何覆盖软件包版本。
答案 1 :(得分:0)
好吧,我从灰姑娘开始,到科学怪人结束,这是我的发现以及对我有用的解决方案。
发现
解决方案
主要YAML:
max
模板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:
- task: PowerShell@2
displayName: "Get Nuget Feed from config"
inputs:
targetType: 'inline'
script: >
$currentLocation = "$(get-location)"
cd $(Build.SourcesDirectory)
#Get file
$file = ".\NuGet.Config"
$content = (Get-Content $file)
Write-Output ("file content: $content")
$regex = '(?<=<add key="CurrentBranchFeed" value=")[^"]*'
Write-Output ("regex: $regex")
$nugetFeed = [regex]::match($content,$regex).Groups[0].Value
Write-Output ("Result: $nugetFeed")
Write-Output ("##vso[task.setvariable variable=NugetFeed;]$nugetFeed")
cd $currentLocation
- template: AzureDevOps/Templates/provision-template.yml
parameters:
projects: |-
**/ProjectA.csproj
**/ProjectB.csproj