1

I get an error like this while i run a pipeline in azure-dev-ops.

##[error]C:\Program Files\dotnet\sdk\6.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): Error NETSDK1005: Assets file 'D:\a\1\s\BlazorAppDB\Server\obj\project.assets.json' doesn't have a target for 'net6.0'. Ensure that restore has run and that you have included 'net6.0' in the TargetFrameworks for your project.

The project which is a blazor wasm project, perfectly runs and publishes from the Visual studio 2022 - however, when its run from a pipeline from azure-dev-ops I get this error

Can some one point as to where to fix this one. I understand its more of an configuration error than functional error.

Venkat
  • 1,702
  • 2
  • 27
  • 47
  • Does this answer your question? [Migrating to .NET 6.0 error on publish: Assets file doesn't have a target for 'net5.0'](https://stackoverflow.com/questions/69507357/migrating-to-net-6-0-error-on-publish-assets-file-doesnt-have-a-target-for-n) – Mohammad Aghazadeh Dec 15 '22 at 10:49

1 Answers1

4

Error NETSDK1005: Assets file 'D:\a\1\s\BlazorAppDB\Server\obj\project.assets.json' doesn't have a target for 'net6.0'. Ensure that restore has run and that you have included 'net6.0

The issue can be related to the nuget tool version you used in your pipeline.

When you use a lower version of Nuget tool (e.g. 4.4.1), it will not be compatible with .net6.0.

To solve this issue, you can add NuGet tool installer Task to specify the pipeline to use higher version of Nuget tool.

- task: NuGetToolInstaller@1
  displayName: 'Use NuGet 6.0.0'
  inputs:
    versionSpec: 6.0.0
Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28