0

I've a VS solution having various projects, all of them targeting .NET6.0

    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>

It builds in visual studio without any problem, and writes the output to bin\debug\net6.0

However, in Azure DevOps pipeline, the build fails with this error

##[error]C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): Error NETSDK1005: Assets file 'C:\Agent3\_work\142\s\*****\obj\project.assets.json' doesn't have a target for 'netcoreapp2.1'. Ensure that restore has run and that you have included 'netcoreapp2.1' in the TargetFrameworks for your project. 2023-03-16T08:57:39.9848471Z C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1005: Assets file 'C:\Agent3\_work\142\s\*****\obj\project.assets.json' doesn't have a target for 'netcoreapp2.1'. Ensure that restore has run and that you have included 'netcoreapp2.1' in the TargetFrameworks for your project. [C:\Agent3\_work\142\s\*****\*****.csproj]

How can I find which dependency is expecting netcoreapp2.1?

Following tasks are in use in the pipeline

  • NuGet tool installer 5.8.0
  • NuGet restore
  • Visual Studio Build (Visual Studio 2022 - dev machine also uses VS2022)
Raheel
  • 421
  • 1
  • 4
  • 7

1 Answers1

0

Issue resolved by replacing Visual Studio Build task with dotnet Build task

Raheel
  • 421
  • 1
  • 4
  • 7