Tempuslight
Tempuslight

Reputation: 1223

Azure Devops Pipeline crashes on .NET 5 version, MSBuild version etc. Any idea how to fix this?

So I've made a back-end project in .NET 5. I'm trying now to make a release pipeline in Azure Devops, where my code is also located.

Errors include:

Error : Version 5.0.100 of the .NET Core SDK requires at least version 16.8.0 of MSBuild. The current available version of MSBuild is 15.9.21.664. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.

Error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.  

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1179,5): Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v5.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.  

Agent job steps

In the above picture's the steps I take:

First I use the almost latest version of Nuget, 5.8.0
Then the next job is a "nuget restore".
The next step is to specifically specify it needs to use .NET 5 SDK (if this job isn't included, Azure Devops throws errors on this, stating that it can't find runtime=net50 etc...).
Here's the more in detail screen:

enter image description here

The next job is the "MSBuild" one, here in more detail:

enter image description here

This "MSBuild" job replaced my "Visual Studio Build" job, because here I could set it to version "16.0" but apparently this doesn't work? The regular "Visual Studio Build" details look just the same, even in my settings, but doesn't include the "MSBuild version" option. Using the regular "Visual Studio Build" option didn't work (see above errors as well).

The next jobs he doesn't even reach yet, so I'll presume for now they work correctly. The issue is indeed with the builds, using SDK, restore etc...

Does anyone who has more experience making azure pipelines/builds in .NET Framework 5.0 or higher have an idea what's wrong here and how I can fix this? Or even an idea where I should look?

I've been breaking my head over this the entire day and it's about to explode...

Upvotes: 0

Views: 1834

Answers (1)

Boris Lipschitz
Boris Lipschitz

Reputation: 9526

You should use a different type of tasks to restore/build etc .net core apps

enter image description here

https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/dotnet-core?view=azure-devops&tabs=dotnetfive

Upvotes: 1

Related Questions