Home: NU1201 for netcoreapp2.0 -> net461 project dependency using new csproj format/sdk, but not for classic csproj

Created on 20 Jun 2017  路  10Comments  路  Source: NuGet/Home

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
dotnet --version => 2.0.0-preview2-006479

VS version (if appropriate): 15.3 preview3 [26615.0.d15rel]

OS version (i.e. win10 v1607 (14393.321)): Win7 SP1

Worked before? Unknown

Detailed repro steps so we can see the same problem

Repro app: NetRef.zip

  1. Create a new .NET Core Console App targeting netcoreapp2.0
  2. Create a new .NET Core Class Library, edit the csproj, and change the TargetFramework to net461 (the same error occurs with net45-net47).
  3. Add the class library as a dependency on the console app and build the project.

Result:
Error NU1201 Project ClassCoreSdk is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Project ClassCoreSdk supports: net461 (.NETFramework,Version=v4.6.1)

Other suggested things

  • VS Intellesence works for this dependency, so the compiler appears to think it's valid.
  • If I instead create a .NET Framework Class Library (e.g. classic .csproj format) targeting .NET 4.6.1 (or any other version) and add it as a dependency then it works fine.

Verbose Logs

logdump.txt

Restore ByDesign Bug

Most helpful comment

@anurse you might think it's rare, but we have a 700 project solution, and converting over existing libraries to .netstandard, so I have 45 errors of NU1201, so not so rare for me. As others move to the new format or create .netstandard projects then this will increase. @rrelyea if it is by design, what is the workaround?

All 10 comments

/cc @rrelyea @davidfowl @Eilon @muratg

Let's understand and fix in post V15.3P3/CLI2P2.
@anurse - let us know if you think this is a V15.3P3/CLI2P2 blocker.

I think we can avoid having it for CLI2P2. It only affects .NET Framework projects using the new SDK-based project system, which is rare, since existing projects will use the older project system.

This is because packages.config projects do not check compatibility during restore. Which is by design.
Build still fails for that scenario.

Hi,
what's the story about this scenario, is it going to be supported ?
Thanks

@anurse you might think it's rare, but we have a 700 project solution, and converting over existing libraries to .netstandard, so I have 45 errors of NU1201, so not so rare for me. As others move to the new format or create .netstandard projects then this will increase. @rrelyea if it is by design, what is the workaround?

  • Created a new .NET Core 2.0 class library
  • Created a new Azure Function in .NET 4.6.1 (Functions don't yet support .NET Core)
  • Make the Azure Function reference the class library (Note: No Nuget)

EXPECTED: Successfully added reference since they are both support .NET Standard 2.0
ACTUAL: Error NU1201 (same as OP)

Since they both support .NET Standard, there has to be a way to reference each other, right?

I have hit this too trying to migrate existing project to .NET standard and the new project system. If I have old-school project file I can reference the net461 project from the .NET Standard class library if I use the new format I get the NU1201 error. Anyone found a workaround?

Folks, thanks for your feedback! This issue appears to be identical to https://github.com/dotnet/standard/issues/481

Please see that issue for workarounds and plan for the future.

I have one class library project as my repository layer that in .netcore 2,0 framework and i am consuming this dll in Azure function project and its giving issue below

Severity Code Description Project File Line Suppression State
Error NU1201 Project Gamification.Services is not compatible with net461 (.NETFramework,Version=v4.6.1). Project Gamification.Services supports: netcoreapp2.0 (.NETCoreApp,Version=v2.0) TurnamentTimerFunctionApp E:\SportsFoundation\TurnamentTimerFunctionApp\TurnamentTimerFunctionApp.csproj 1

can anyone help

Was this page helpful?
0 / 5 - 0 ratings