How do I reference a .NET Framework project in a .NET Core project?

Justin Helgerson :

I'd really like to start using .NET Core and slowly migrate applications and libraries to it. However, I can't realistically upgrade my entire code base to use .NET Core and then go through the process of testing and deploying a plethora of applications in production.

As an example, if I create a new .NET Core application and try to reference one of my .NET Framework projects I get the following:

The following projects are not supported as references: - Foobar.NetFramework has target frameworks that are incompatible with targets in current project Foobar.NetCore.

Foobar.NetCore: .NETCoreApp,Version=v1.0

Foobar.NetFramework: .NETFramework,Version=v4.5

Is it possible to create a new .NET Core application and reference my existing .NET Framework libraries? If so, what's the process for doing that? I've spent hours going through Microsoft's documentation and searching their issues on GitHub, but I can't find anything official on how to achieve this or what their long-term vision is for this process.

aholtry :

Yes, we are currently attempting the same thing. The trick is to make sure that you are supporting the same .NET frameworks. Inside your project.json file, make sure the framework matches the framework of the project you wish to include. For example:

"frameworks": {
    "net46": {  --This line here <<<<
      "dependencies": {
        "DomainModel": {
          "target": "project"
        },
        "Models": {
          "target": "project"
        }
      }
    }
  },

FYI: You might need to change the framework of your .NET Core or your older projects to achieve this. .NET Core can be changed just by editing the project.json file as seen above. You can so the same in .NET projects by right clicking the project and opening properties. Change the framework level there.

Once you have matched the two project frameworks then you should be able to include them. Good Luck!

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

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

編集
0

コメントを追加

0

関連記事

分類Dev

How do I reference a .NET Framework project in a .NET Core project?

分類Dev

How do I reference a .NET Framework project in a .NET Core project?

分類Dev

How do I add an Angular project to an exisiting .NET Core Web API project?

分類Dev

How to include reference to assembly in ASP.NET Core project

分類Dev

Is it possible to reference .net framework 4.7.2 class library from an ASP.NET Core MVC project?

分類Dev

How do I make project modifications to store Asp .net Core Angurlar 6 bundle in CDN

分類Dev

Use full .NET Framework with existing ASP.NET Core project

分類Dev

How to I access the DbContext of EF core from another project when used in ASP.NET core?

分類Dev

.NET Core project dependency "bleed"

分類Dev

How do you disable HTTPS in ASP.NET Core project with Identity?

分類Dev

How do you disable HTTPS in ASP.NET Core project with Identity?

分類Dev

How can I read version of project in dotnet core (formerly asp.net mvc6)

分類Dev

Why do Service Stack dot net core project templates include a types folder in the service model project with a .GitIgnore

分類Dev

how do i consume net.tcp binding within web project?

分類Dev

Change .NET Framework in Integration Services Project

分類Dev

With DotNet (Core/Standrad) how do I the project version at build time?

分類Dev

How can I build a project with multiple .net frameworks for nuget package

分類Dev

Can I have an analyzer on a .net 4.5 project?

分類Dev

How do I programmatically test CDN integrity in .NET Core?

分類Dev

How do I mock/stub HttpRequestMessage in .NET Core?

分類Dev

How to store configuration information in a .net Standard project

分類Dev

How to convert a VB.Net project to .NetCore

分類Dev

.NET Core: How to use csproj-based projects alongside project.json?

分類Dev

How to read Request.Form values in MVC view of asp.net core project?

分類Dev

ServiceStack using DotNetStandard Service Model in .Net framework web project

分類Dev

Mocking framework for ASP.net 5.0 vnext class library project

分類Dev

connection string in asp.net core library project

分類Dev

System.Automation.Runspaces Error in .NET Core project

分類Dev

New Project list not populating v2 (.NET Core)

Related 関連記事

  1. 1

    How do I reference a .NET Framework project in a .NET Core project?

  2. 2

    How do I reference a .NET Framework project in a .NET Core project?

  3. 3

    How do I add an Angular project to an exisiting .NET Core Web API project?

  4. 4

    How to include reference to assembly in ASP.NET Core project

  5. 5

    Is it possible to reference .net framework 4.7.2 class library from an ASP.NET Core MVC project?

  6. 6

    How do I make project modifications to store Asp .net Core Angurlar 6 bundle in CDN

  7. 7

    Use full .NET Framework with existing ASP.NET Core project

  8. 8

    How to I access the DbContext of EF core from another project when used in ASP.NET core?

  9. 9

    .NET Core project dependency "bleed"

  10. 10

    How do you disable HTTPS in ASP.NET Core project with Identity?

  11. 11

    How do you disable HTTPS in ASP.NET Core project with Identity?

  12. 12

    How can I read version of project in dotnet core (formerly asp.net mvc6)

  13. 13

    Why do Service Stack dot net core project templates include a types folder in the service model project with a .GitIgnore

  14. 14

    how do i consume net.tcp binding within web project?

  15. 15

    Change .NET Framework in Integration Services Project

  16. 16

    With DotNet (Core/Standrad) how do I the project version at build time?

  17. 17

    How can I build a project with multiple .net frameworks for nuget package

  18. 18

    Can I have an analyzer on a .net 4.5 project?

  19. 19

    How do I programmatically test CDN integrity in .NET Core?

  20. 20

    How do I mock/stub HttpRequestMessage in .NET Core?

  21. 21

    How to store configuration information in a .net Standard project

  22. 22

    How to convert a VB.Net project to .NetCore

  23. 23

    .NET Core: How to use csproj-based projects alongside project.json?

  24. 24

    How to read Request.Form values in MVC view of asp.net core project?

  25. 25

    ServiceStack using DotNetStandard Service Model in .Net framework web project

  26. 26

    Mocking framework for ASP.net 5.0 vnext class library project

  27. 27

    connection string in asp.net core library project

  28. 28

    System.Automation.Runspaces Error in .NET Core project

  29. 29

    New Project list not populating v2 (.NET Core)

ホットタグ

アーカイブ