.net core Azure Devops管道-使用指定目标框架DotNetCoreCLI@2

.net core Azure Devops管道-使用指定目标框架DotNetCoreCLI@2,.net-core,azure-devops,azure-pipelines,azure-pipelines-build-task,.net Core,Azure Devops,Azure Pipelines,Azure Pipelines Build Task,是否可以使用Azure Devops构建管道和DotNetCoreCLI@2任务或者我们必须恢复使用脚本并手动调用dotnet publish命令吗 我的管道YAML中的一个片段 variables: buildConfiguration: 'Debug' steps: - task: DotNetCoreCLI@2 inputs: command: 'publish' publishWebProjects: false # Required when command

是否可以使用Azure Devops构建管道和DotNetCoreCLI@2任务或者我们必须恢复使用脚本并手动调用
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
任务可以使用
参数
属性进行扩展,您可以在该属性上指定框架(以及构建配置):


你好@JLo;附带问题:您是否尝试设置buildConfiguration:“Release”?因为当我这样做时,构建使用的是“调试”
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. 
steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'publish' 
    publishWebProjects: false # Required when command == Publish
    projects: 'TestProject/Test/Test.csproj'
    arguments: '--configuration $(BuildConfiguration) --framework netcoreapp2.1'