使用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>
我正在使用这里的文档来完成
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.