【问题标题】:Azure Pipelines: .NET Core 3.0: Can't publishAzure Pipelines:.NET Core 3.0:无法发布
【发布时间】:2019-09-21 21:47:01
【问题描述】:

我遇到了 Azure Pipelines 的问题。我正在尝试构建一个 ASP.NET Core 3.0 项目。是的,我知道它还不支持,但其他 questions 说你可以通过在管道脚本中包含以下内容来做到这一点。但是,我不确定该怎么做。

  • 任务:DotNetCoreInstaller@0
    displayName: '安装 .net core 3.0(预览版)'
    输入:版本:'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)'

【问题讨论】:

    标签: azure-devops azure-pipelines .net-core-3.0


    【解决方案1】:

    我是在下面的脚本中粘贴以下内容还是将其放置在哪里

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

    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即可获得:

    我目前正在预览 9,是否支持它呢

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

    作为测试结果:

    希望这会有所帮助。

    【讨论】:

    • 感谢 leo 的详细回答我不知道为什么它被否决但谢谢你
    • @rogue39nin,随时。我也不知道谁投了反对票。有些人可能对这个问题有一些误解。无论如何,不​​要太担心。
    【解决方案2】:

    您可能想要使用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

    【讨论】:

    • 当我查看最右侧的任务列表时,我没有看到该任务。
    • 尝试直接将其添加到您的 yaml 中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-21
    • 2019-09-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多