Azure Pipelines:.NET Core 3.0:无法发布

Azure Pipelines: .NET Core 3.0: Can't publish

我在使用 Azure Pipelines 时遇到问题。我正在尝试构建一个 ASP.NET Core 3.0 项目。是的,我知道它还不受支持,但其他 表示您可以通过在管道脚本中包含以下内容来实现。但是,我不确定该怎么做。

  • task: DotNetCoreInstaller@0
    displayName: 'Install .net core 3.0 (preview)'
    inputs: version: '3.0.100-preview6-012264'

我是否将以上内容粘贴到以下脚本中?如果没有,我应该把它放在哪里?另外,我目前使用的是 Preview 9——支持吗?

# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'ubuntu-latest' 


variables:
  buildConfiguration: 'Release'

steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

您可能想使用 UseDotNet@2 任务。您可以将其添加到步骤列表中。

这是一个例子...

- steps:

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 3.x
    includePreviewVersions: true
    installationPath: $(Agent.ToolsDirectory)/dotnet

- script: ... etc etc
  displayName: Continue as normal, now that the .net core 3.x SDK is installed.

是的,支持 preview9。 rc1也是。此步骤安装最新的 3.x 版本并包括所有预览版。发布后,您可以根据需要删除 includePreviewVersions 字段。

有关更多信息,文档位于此处:https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops

Do I paste the following in the below script or where would i place it

您可以在 步骤 的开头粘贴以下脚本,例如:

steps:
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 3.0.100-preview9-014004'
  inputs:
    version: '3.0.100-preview9-014004'
    includePreviewVersions: true

- task: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'
  ...

在搜索框搜索use .net core即可获取:

I am on preview 9 at present does that support it yet

答案是肯定的。本任务用于安装.NET SDK,支持.NET core 3.0预览versions list.

作为测试结果:

希望对您有所帮助。