Sdk: .NET Core project reference from .NET app fails at runtime

Created on 30 Jan 2017  路  6Comments  路  Source: dotnet/sdk

_From @maloo on January 29, 2017 1:2_

Repro:
Create a .NET console app and a .NET core library targetting .net standard. (I also had to change to .NET 4.6.2 and .net standard 1.5) Add reference to library project in .net console app and run the app. This will fail with System.Runtime 4.1 load failure.

Workaround:
Manually add Netstandard.Library package to console app

Expected behavior:
If I add a project reference to a .net standard dll project I expect the package dependencies of that project to be picked up by msbuild. Having to pack/deploy a library as a nuget and reference the package is NOT the way to go for project references.

Version:
VS2017RC, 26th Jan

_Copied from original issue: Microsoft/msbuild#1626_

Bug

Most helpful comment

This is because package references don't by default flow from project to project. PackageReference support fixes that. So you to fix this, you can either add a package reference to the .NET Framework project and select PackageReference over packages.config when it asks you, or you can add the following property to the .csproj:

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

All 6 comments

_From @cdmihai on January 30, 2017 17:38_

@davkean @srivatsn

This sounds more like an SDK or project system issue. If that is the case, can you please re-open it on the better suited repo page?

Is it the same issue as #686?

This is because package references don't by default flow from project to project. PackageReference support fixes that. So you to fix this, you can either add a package reference to the .NET Framework project and select PackageReference over packages.config when it asks you, or you can add the following property to the .csproj:

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

Going to dup this against: https://github.com/NuGet/Home/issues/4488 which is tracking the experience.

This problem is still active as of the latest version of Visual Studio 2017 as it's what I am using!

@isaacwalkercox this bug was dup'd against https://github.com/NuGet/Home/issues/4488, which is still open.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ulrichb picture ulrichb  路  3Comments

darrensimio picture darrensimio  路  3Comments

thomaslevesque picture thomaslevesque  路  3Comments

noelitoa picture noelitoa  路  3Comments

gkhanna79 picture gkhanna79  路  3Comments