【发布时间】:2018-10-03 13:43:18
【问题描述】:
是否可以使用 Azure Devops Build Pipelines 和 DotNetCoreCLI@2 任务为 ClassLibrary 项目指定目标框架?还是我们必须恢复使用脚本并手动调用dotnet publish 命令?
我的管道 YAML 中的一个 sn-p
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 任务,但它并不总是很好。
编辑:我应该在构建完全失败时添加,因为:
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.
【问题讨论】:
-
你好@JLo;附带问题:您是否尝试设置 buildConfiguration: 'Release' ?因为当我这样做时,构建正在使用“调试”
标签: .net-core azure-devops azure-pipelines azure-pipelines-build-task