Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ensure that restore has run and that you have > included 'net6.0' in the TargetFrameworks for your project

Tags:

azure-devops

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.

like image 645
Venkat Avatar asked Nov 30 '25 12:11

Venkat


1 Answers

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
like image 57
Kevin Lu-MSFT Avatar answered Dec 05 '25 16:12

Kevin Lu-MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!