4

I have two projects: one project is built on .NET Core and the other one is built on normal .NET Framework 4.5.2.

I want to know how I can use my .NET Core cass library in my .NET Console Application.

Here is my project.json:

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "NLog.Web.AspNetCore": "4.3.0",
    "System.Xml.XmlSerializer": "4.0.11"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    },
    "net452": {}
  }
}

I tried to include the project as a normal reference. But after re-building the solution the Console Application still doesn't get the .NET Core library as a reference.

1
  • Use Visual Studio 2017 and try again. Commented Jan 30, 2017 at 14:26

1 Answer 1

3

Visual Studio 2017 can do this natively; Visual Studio 2015 cannot (as of Update 3). A lot of these tooling bugs and issues are being fixed and finalized with the stable version of the .NET Core tooling, expected with VS 2017.

There are two workarounds you can use today, if you are still using VS 2015:

  • Use dotnet pack to produce a NuGet package for the class library. Since you target net452 in your project.json, it will be compatible with a .NET Framework 4.5.2 project. You can host it on a local feed and install it in your console application project.

  • Manually reference the DLL that's produced when you compile the library. It should be at bin/net452/YourLibrary.dll. This isn't a great solution because it's brittle and can break easily.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.