My team recently migrated to .NET 6.0 and after adding one of our projects back to the solution it was found that while it is building and running locally in Visual Studio just fine, in our Azure DevOps pipeline it fails with the following:
C:\hostedtoolcache\windows\dotnet\sdk\6.0.405\Microsoft.Common.CurrentVersion.targets(4099,5): Error MSB4062: The "Microsoft.Build.Tasks.RequiresFramework35SP1Assembly" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
I have been trying to update relevant packages and been researching online for a solution as to why this is happening but have no luck. Does anyone have an idea of what would be causing this and how to fix it?