Using .NET Core library in .NET 4.5.2 console application

Erick Boshoff

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.

Nate Barbettini

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.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Is there a way to make a console application run using only a single file in .NET Core?

分類Dev

Migrating Identity in .net core 2 class library

分類Dev

Compile .NET 5 Library

分類Dev

Using ELMAH inside my asp.net mvc 4 & MVC5 web application

分類Dev

Console.Write in .Net Core

分類Dev

Howto debug .NET 5 WinForms application that references .NET Framework 4.8 class library in Visual Studio 2019

分類Dev

JWT Authentication for .net core 2.2 application not using Identity

分類Dev

Application Insights in Net Core 2 WebApi - Share Context To Append Properties

分類Dev

Is EF Core missing anything in .NET Standard vs .NET Core library?

分類Dev

ASP.NET Core 2.x、データテーブル付きAngular 4/5

分類Dev

Does .NET Core work with the NUnit console runner?

分類Dev

.NET Core 3.1 Console App as a Windows Service

分類Dev

Difference between using the ASP.NET Core Web Application (.NET Core) with net461 set as the only framework and using the (.NET Framework) template

分類Dev

Difference between using the ASP.NET Core Web Application (.NET Core) with net461 set as the only framework and using the (.NET Framework) template

分類Dev

How to generate a standalone console application from .NET

分類Dev

In ASP.NET CORE application EF Core library do not return new inserted record's ID from database?

分類Dev

ASP.NET Core 2 MVC + EF Core2またはAngular5

分類Dev

Class library that can be shared between .NET Framework and .NET Core

分類Dev

Referencing .NET 4.6.2 class library from .NET Core app

分類Dev

Which .Net framework should my .Net Core library target?

分類Dev

WPF Control Library Target .NET Core 3 or .NET Framework?

分類Dev

When using .Net Standard 1.4 in a library and .Net framework 4.6.1 in and application, unable to load file System.IO.FileSystem, Version=4.0.1.0

分類Dev

.NET Core 2 Password Hashing

分類Dev

Path to LocalAppData in ASP.Net Core application

分類Dev

Localizable asp.net core + reactjs application

分類Dev

Windows Authentication in .net Core 2.1 application

分類Dev

Debug .net core application deployed on local IIS?

分類Dev

How to load a .NET Core assembly from an application written in .NET Framework?

分類Dev

.NET application (WinForms) depending on ASP.NET Core server

Related 関連記事

  1. 1

    Is there a way to make a console application run using only a single file in .NET Core?

  2. 2

    Migrating Identity in .net core 2 class library

  3. 3

    Compile .NET 5 Library

  4. 4

    Using ELMAH inside my asp.net mvc 4 & MVC5 web application

  5. 5

    Console.Write in .Net Core

  6. 6

    Howto debug .NET 5 WinForms application that references .NET Framework 4.8 class library in Visual Studio 2019

  7. 7

    JWT Authentication for .net core 2.2 application not using Identity

  8. 8

    Application Insights in Net Core 2 WebApi - Share Context To Append Properties

  9. 9

    Is EF Core missing anything in .NET Standard vs .NET Core library?

  10. 10

    ASP.NET Core 2.x、データテーブル付きAngular 4/5

  11. 11

    Does .NET Core work with the NUnit console runner?

  12. 12

    .NET Core 3.1 Console App as a Windows Service

  13. 13

    Difference between using the ASP.NET Core Web Application (.NET Core) with net461 set as the only framework and using the (.NET Framework) template

  14. 14

    Difference between using the ASP.NET Core Web Application (.NET Core) with net461 set as the only framework and using the (.NET Framework) template

  15. 15

    How to generate a standalone console application from .NET

  16. 16

    In ASP.NET CORE application EF Core library do not return new inserted record's ID from database?

  17. 17

    ASP.NET Core 2 MVC + EF Core2またはAngular5

  18. 18

    Class library that can be shared between .NET Framework and .NET Core

  19. 19

    Referencing .NET 4.6.2 class library from .NET Core app

  20. 20

    Which .Net framework should my .Net Core library target?

  21. 21

    WPF Control Library Target .NET Core 3 or .NET Framework?

  22. 22

    When using .Net Standard 1.4 in a library and .Net framework 4.6.1 in and application, unable to load file System.IO.FileSystem, Version=4.0.1.0

  23. 23

    .NET Core 2 Password Hashing

  24. 24

    Path to LocalAppData in ASP.Net Core application

  25. 25

    Localizable asp.net core + reactjs application

  26. 26

    Windows Authentication in .net Core 2.1 application

  27. 27

    Debug .net core application deployed on local IIS?

  28. 28

    How to load a .NET Core assembly from an application written in .NET Framework?

  29. 29

    .NET application (WinForms) depending on ASP.NET Core server

ホットタグ

アーカイブ