1
votes

I am having an issue with Azure Pipelines. I am trying to build an ASP.NET Core 3.0 project. Yes, I know it's not supported yet, but other questions say you can do it by including the following in the pipeline script. I am not sure how to do that, however.

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

Do I paste the above in the following script? If not, where would I place it? Also, I am on Preview 9 at present—is that supported yet?

# 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)'
2

2 Answers

3
votes

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

You can paste following scripts at begin of Steps, like:

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)'
  ...

You can get it by searching use .net core in the search box:

enter image description here

enter image description here

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

The answer is yes. This task is used to install the .NET SDK, which supports the .NET core 3.0 preview versions list.

As test result:

enter image description here

Hope this helps.

0
votes

You probably want to use the UseDotNet@2 task. You can add it to your list of steps.

Here's an example...

- 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.

And yes, preview9 is supported. So is rc1. This step installs the latest 3.x version and includes all previews. Once it's released, you can remove the includePreviewVersions field if you want.

For more info, the docs are here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops