sdk: "dotnet build" failed with error NETSDK1073 for the .NET core 3.0 app with reference to a .NET Standard 2.1 class lib

Steps to reproduce

  1. Install .NET core sdk 3.0.100-preview6-012012
  2. Create a .NET core 3.0 app with reference to a .NET Standard 2.1 class lib with below CLI dotnet new console -o consoleapp30 dotnet new classlib -n CSNS21Lib -f netstandard2.1 dotnet add reference …\CSNS21Lib\CSNS21Lib.csproj
  3. run “dotnet build” to observe the result

##Note

  1. This issue also repro with VS
  2. This issue is not repro on the .NET core 3.0 app with reference to a .NET Standard 2.0 class lib

Expected behavior

The project can be built successfully

Actual behavior

Build with error NETSDK1073: The FrameworkReference ‘NETStandard.Library’ was not recognized image

Environment data

dotnet --info output: .NET Core SDK (reflecting any global.json): Version: 3.0.100-preview6-012012 Commit: 94b54a5ef6

Runtime Environment:
OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview6-012012\

Host (useful for support): Version: 3.0.0-preview6-27718-08 Commit: 7c7a2e9074

.NET Core SDKs installed: 2.1.800-preview-009677 [C:\Program Files\dotnet\sdk] 2.2.400-preview-010195 [C:\Program Files\dotnet\sdk] 3.0.100-preview6-012012 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview6-19265-03 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview6-27718-08 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0-preview6-27718-08 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 34 (17 by maintainers)

Commits related to this issue

Most upvoted comments

As a workaround, you can put the following in your .NET Core project which references .NET Standard 2.1:

  <Target Name="WorkaroundNetStandard" AfterTargets="ResolvePackageAssets">
    <ItemGroup>
      <TransitiveFrameworkReference Remove="NETStandard.Library" />
    </ItemGroup>
  </Target>

This is working using the latest VS build and the latest preview6 CLI.

@livarcocc - Specifically which versions? I still get this error with the following versions:

NetCoreApp3.0: preview6-27804-01 Visual Studio: 16.1.3

You have to use the latest Visual Studio preview.

@robborden Can you open a new issue for the failures you’re encountering? The error message is the same but I don’t believe the root cause is the same as this issue which has been fixed. Thanks!

@dsplaisted you say it should be fix now? I still can’t build my solution using Visual Studio Build task in TFS. The VS version installed on the build machine is : 16.3.29324.140 I have the following error : ##[error]C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(263,5): Error NETSDK1073: The FrameworkReference ‘NETStandard.Library’ was not recognized

The CSproj of this project contains : “PropertyGroup <TargetFramework>netstandard2.1</TargetFramework> /PropertyGroup

The main project.csproj contains : “PropertyGroup <TargetFramework>netcoreapp3.0</TargetFramework> <OutputPath>…..\bin$(Configuration)</OutputPath> /PropertyGroup

I’m still seeing this issue when building with Azure DevOps using the MSBuild Task, even on the 3.0.100 release of .net core sdk.

Adding this also solves this error in projects that fail to build:

<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>

This is working using the latest VS build and the latest preview6 CLI.

@livarcocc - Specifically which versions? I still get this error with the following versions:

NetCoreApp3.0: preview6-27804-01 Visual Studio: 16.1.3

This is working using the latest VS build and the latest preview6 CLI.