Referencing .NET Core library in .NET 4.5.2

后端 未结 2 563
别那么骄傲
别那么骄傲 2020-12-31 10:39

Is it possible to reference a .NET Core library in a .NET 4.5.2 project? I\'m using the latest rc of .NET Core and want to use the same library for my WPF project and my .NE

相关标签:
2条回答
  • 2020-12-31 11:00

    I answered that here: stackoverflow link

    But my answer is for at least 4.6.2. If it works bellow that you have to try or upgrade if possible

    0 讨论(0)
  • 2020-12-31 11:09

    As of now (June 2016), there are two steps required:

    1. Make sure your .NET Core project is building for net452 or netstandard1.2 (which includes net452 according to the docs). This will ensure that your project will output a binary that your .NET 4.5.2 project can use.

    2. Create a nuget package from your .NET Core project with dotnet pack. Host this locally or on MyGet. Referencing this package in your .NET 4.5.2 application will pull in the correct binary!

    Visual Studio will apparently be able to directly reference .NET Core projects from csproj projects in the future, but for now, step 2 is the best workaround I've found.

    0 讨论(0)
提交回复
热议问题