Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Core 3.1 application not building on Azure pipeline anymore (.NET 5)

Until recently our .Net Core 3.1 applications were building and publishing fine on Azure pipelines. But over the last couple of days the build pipelines have started to fail with the error:

##[error]C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): 
Error NETSDK1005: Assets file 'D:\a\1\s\ProjectFolder\src\Project\obj\project.assets.json' doesn't have a target for 'netcoreapp3.1'. 
Ensure that restore has run and that you have included 'netcoreapp3.1' in the TargetFrameworks for your project.
(ResolvePackageAssets target) -> 
  C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): 
error NETSDK1005: Assets file 'D:\a\1\s\ProjectFolder\src\Project\obj\project.assets.json' doesn't have a target for 'netcoreapp3.1'. 
Ensure that restore has run and that you have included 'netcoreapp3.1' in the TargetFrameworks for your project. [D:\a\1\s\ProjectFolder\src\Project\Project.csproj]

The build pipeline is setup as follows for the solution build step that is failing.

Build configuration - using latest, but setting to VS 2019 also fails.

Any ideas how to resolve this with the least amount of change?

like image 553
nealsu Avatar asked Nov 20 '20 03:11

nealsu


Video Answer


1 Answers

.NET Core 3.1 application not building on Azure pipeline anymore (.NET 5)

Please try to update the nuget.exe to the 5.8.0 by the task NuGet tool installer:

enter image description here

You could check this thread for some more details.

like image 86
Leo Liu-MSFT Avatar answered Oct 02 '22 20:10

Leo Liu-MSFT