Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

asp.net core - Version 5.0 is not allowed. Allowed version types are: majorVersion.x, majorVersion.minorVersion.x, majorVersion.minorVersion.patchVersion

Recently we migrated a .NET Core 3.1 project to .NET 5.0. We have few pipelines setup using AzureDevOps

On Modifying the version of .NET Core SDK task from 3.1.x to 5.0; we faced the below exception

##[error]Version 5.0 is not allowed. Allowed version types are: majorVersion.x, majorVersion.minorVersion.x, majorVersion.minorVersion.patchVersion. More details: The version number: 5.0 doesn't have the correct format. Versions can be given in the following formats: 2.x => Install latest in major version. 2.2.x => Install latest in major and minor version. 2.2.104 => Install exact version. Find the value of version for installing SDK/Runtime, from the releases.json. The link to releases.json of that major.minor version can be found in releases-index file.. Like link to releases.json for 2.2 version is https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json

Has AzureDevOps not been updated to .NET 5.0 or do we have to run test projects and pipelines only in .NET Core 3.1.x?

Also we are unable to locate any Agent job task available for .NET 5.0 in the Marketplace tab while creating the tasks.

question from:https://stackoverflow.com/questions/65621739/version-5-0-is-not-allowed-allowed-version-types-are-majorversion-x-majorvers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You probably need to use UseDotNet task to get the .NET 5.0 downloaded and used in subsequent dotnet build task. See below example:

- task: UseDotNet@2
  displayName: 'Install .Net 5 SDK'
  inputs:
    packageType: 'sdk'
    version: '5.0.100'

- task: DotNetCoreCLI@2
  inputs:
    command: 'build'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...