nealsu
nealsu

Reputation: 438

.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?

Upvotes: 13

Views: 3650

Answers (2)

Manfred Wippel
Manfred Wippel

Reputation: 2076

had the same problem with a local build agent

error NETSDK1005: Assets file 'project.assets.json' ....

Update NuGet.exe to the 5.8.0 version or above

and clearing NuGet cache:

dotnet nuget locals all --clear

Download Nuget

found here

Upvotes: 2

Leo Liu
Leo Liu

Reputation: 76910

.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.

Upvotes: 17

Related Questions