question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NETSDK1073 for .NET Core 2.2 | Builds Fail

See original GitHub issue

Preface

I am reporting this here based on this comment from a (possibly) related issue. _Originally posted by @dsplaisted in https://github.com/dotnet/cli/issues/11378#issuecomment-539583642_

@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!

This is from the dotnet/CLI repo but when you go to create a new issue there the text reads:

PLEASE DO NOT FILE ISSUES IN THIS REPO File them in https://github.com/dotnet/sdk instead.

If this is the wrong location let me know.

Problem Description

I am using Visual Studio 2019 version 16.3.8. I have a solution with these frameworks:

  • Project1 targets netcoreapp2.2
  • Project2 targets netstandard2.0
  • Project3 targets netcoreapp2.2
  • Project4 targets netcoreapp2.2

When I rebuilt the solution I am now getting an unexpected error from each project:

“The FrameworkReference ‘.NETStandard,Version=v2.0’ was not recognized” The file referenced is Microsoft.NET.Sdk.FrameworkReferenceResolution.Targets on line 236. This points to:

<ResolveTargetingPackAssets FrameworkReferences="@(FrameworkReference)"
                                ResolvedTargetingPacks="@(ResolvedTargetingPack)"
                                RuntimeFrameworks="@(RuntimeFramework)"
                                GenerateErrorForMissingTargetingPacks="$(GenerateErrorForMissingTargetingPacks)">

Trying this with dotnet build produces the same error:

λ dotnet build
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 819.77 ms for C:\Users\<my username>\dev\projects\<My Project>\MyNamespace.Models\MyNamespace.Models.csproj.
  Restore completed in 7.7 sec for C:\Users\<my username>\dev\projects\<My Project>\MyNamespace.Endpoint\MyNamespace.Endpoint.csproj.
  Restore completed in 7.81 sec for C:\Users\<my username>\dev\projects\<My Project>\MyNamespace.Tests\MyNamespace.Tests.csproj.
  Restore completed in 12.02 sec for C:\Users\<my username>\dev\projects\<My Project>\MyNamespace.Proxy\MyNamespace.Proxy.csproj.
  
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,Version=v2.0' was not recognized [C:\Users\<my username>\dev\projects\<My Project>\MyNamespace.Models\MyNamespace.Models.csproj]

Build FAILED.

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,Version=v2.0' was not recognized [C:\Users\<my username>\dev\projects\<My Project>\MyNamespace.Models\MyNamespace.Models.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:23.39

Workaround

Open the project in Visual Studio 2017 and I am able to produce builds without error.

Expected behavior

The project would not report errors and could be built.

Environment Data

λ dotnet --info .NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26

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

Host (useful for support): Version: 3.0.0 Commit: 7d57652f33

.NET Core SDKs installed: 2.1.402 [C:\Program Files\dotnet\sdk] 2.1.502 [C:\Program Files\dotnet\sdk] 2.1.801 [C:\Program Files\dotnet\sdk] 2.1.802 [C:\Program Files\dotnet\sdk] 2.2.105 [C:\Program Files\dotnet\sdk] 2.2.401 [C:\Program Files\dotnet\sdk] 2.2.402 [C:\Program Files\dotnet\sdk] 3.0.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dsplaistedcommented, Nov 20, 2019

Delete all the frameworkReferences from the .nuspec:

    <frameworkReferences>                                                                                                                   
      <group targetFramework=".NETStandard1.2">                                                                                             
        <frameworkReference name=".NETStandard,Version=v1.2" />                                                                             
      </group>                                                                                                                              
      <group targetFramework=".NETStandard1.6">                                                                                             
        <frameworkReference name=".NETStandard,Version=v1.6" />                                                                             
      </group>                                                                                                                              
      <group targetFramework=".NETStandard2.0">                                                                                             
        <frameworkReference name=".NETStandard,Version=v2.0" />                                                                             
      </group>                                                                                                                              
    </frameworkReferences>    

If you’ve done this and are still getting the error, make sure to bump the package version so you’re sure you’re not getting an older version, and you can open up the .nupkg in NuGet Package Explorer to ensure that the frameworkReferences aren’t still in the package.

0reactions
w5922xdcommented, Nov 20, 2019

Removed the frameworkReferences, incremented my version, then ran dotnet pack. I upgrade the packages in my solution and it is now functioning. Thank you!

The frameworkReferences were my problem? Really appreciate your help @dsplaisted and @nkolev92

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET SDK error list - .NET CLI
NET Core 2.2 and lower. NETSDK1094, Unable to optimize assemblies for performance: a valid runtime package was not found.
Read more >
Problem in Building Project in Asp.net Core 2.2
I'm facing a problem of building a project of ASP.NET core 2.2 in visual studio 2017. Please Note that I'm successfully able to...
Read more >
Error NETSDK1073: The FrameworkReference 'Microsoft. ...
Plugins.Popup, but it builds and deploys fine in iOS and android. Same projects works fine in my VS2019 in Windows machine. In mac...
Read more >
.NET Core 3.1 - The FrameworkReference 'Microsoft ...
Today I upgraded my .NET Core 2.2 application to 3.1. My solution builds fine in Visual Studio but NCrunch fails to compile my...
Read more >
SAST Analyzer error with .NET - Unable to build project ...
Use the Gitlab SAST template in the .gitlab-ci.yml and run it. What is the current bug behavior? This is the output of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found