NET7 | Azure DevOps

Can’t use your pipeline in Azure DevOps with .NET7? Here is a solution!

After upgrading your app to a newer .NET version the cloud build agent of Azure DevOps fails. Here is what you can do against it!

xeladu

--

Image from Pexels

.NET7 was released some days ago. Today, I upgraded one of my apps, pushed it to my Git repository hosted in Azure DevOps, and waited for the build pipeline to finish. But sadly, I received an error message

error NETSDK1045: The current .NET SDK does not support targeting .NET 7.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 7.0.

The reason is that the Azure VM images used for pipelines are not updated yet. It will take some time before .NET7 will be preinstalled on them.

🔔 Get a short summary of my Medium content on the 1st of each month to your inbox. Save time and pick what you like to read! 

Click HERE to subscribe for free!

To fix the issue, you need to use the Use .NET Core task and select 7.x as a version.

Use .NET Core task to install specific .NET version in Azure Pipelines

Insert the task before your other .NET tasks and your pipeline should work again. It will download and install the most recent .NET7 version to the agent.

Use .NET Core task in YAML syntax in Azure Pipelines

Your pipeline should work again after that!

For more details have a look at the discussion on GitHub.

Solutions for common coding problems

10 stories

The Azure DevOps Handbook

9 stories

--

--

xeladu

Flutter and Firebase expert, blogger on QuickCoder.org, find my ebooks and freebies on shop.quickcoder.org, contact me on me.quickcoder.org!