Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: #20740

Open
1 of 4 tasks
tnlthanzeel opened this issue Dec 18, 2024 · 1 comment
Open
1 of 4 tasks

[Question]: #20740

tnlthanzeel opened this issue Dec 18, 2024 · 1 comment

Comments

@tnlthanzeel
Copy link

tnlthanzeel commented Dec 18, 2024

Task name

Build

Task version

No response

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

ubuntu latest

Question

im trying to build my asp core 9 app on a hosted agent  which i updated to dotnet 9 from dotnet 8 today, but i get the error . it does build when i change it to dot net 8

**Error**

##[error]/usr/share/dotnet/sdk/8.0.404/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(166,5): Error NETSDK1045: The current .NET SDK does not support targeting .NET 9.0.  Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 9.0. Download the .NET SDK from https://aka.ms/dotnet/download
/usr/share/dotnet/sdk/8.0.404/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(166,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 9.0.  Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 9.0. Download the .NET SDK from https://aka.ms/dotnet/download [/home/vsts/work/1/s/SeekNow.Account/SeekNow.Account.csproj]

**yaml file**

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

name: $(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
trigger:
- Dev

pool:
  vmImage: 'ubuntu-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
    - task: NuGetToolInstaller@1

    - task: NuGetCommand@2
      displayName: 'Nuget Restore'
      inputs:
        command: restore
        restoreSolution: '$(solution)'
        # feedsToUse: 'select'
        # vstsFeed: 'GalleryERP.Feed'
    
    - task: DotNetCoreCLI@2
      displayName: 'Build'
      inputs:
        command: 'build'
        projects: '$(solution)'

@aleksandrlevochkin
Copy link
Contributor

Hi @tnlthanzeel, thank you for bringing this issue up. Unfortunately, it seems that .NET 9 is not included in the ubuntu images yet: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#net-tools

As a workaround you can use the task UseDotNet@2 that will install a specific .NET version on the hosted agent:

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '9.0.x'

Please, make sure it is placed before other .NET-related steps in your pipeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants