是否可以使用Azure Devops Build Pipelines和DotNetCoreCLI @ 2任务为ClassLibrary项目指定目标框架?或者我们是否必须恢复使用脚本并手动调用 dotnet publish
命令?
我的管道YAML的一个片段
variables:
buildConfiguration: 'Debug'
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: false # Required when command == Publish
projects: 'TestProject/Test/Test.csproj'
configuration: '$(BuildConfiguration)'
从我的.csproj:
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net45</TargetFrameworks>
</PropertyGroup>
我正在使用文档here来执行 DotNetCoreCLI@2
任务,但它并不总是很棒 .
EDIT: 我应该在Build完全失败时添加,因为:
The 'Publish' target is not supported without specifying a target framework.
The current project targets multiple frameworks, please specify the framework
for the published application.
1 回答
可以使用
arguments
属性扩展DotNetCoreCLI@2
任务,您可以在该属性上指定框架(以及构建配置):