Reference a .Net 4.6.2 project in a .NetCore proje

2019-01-29 14:22发布

I have a .Net core 2.0 project which needs to reference a .Net 4.6.2 projets (BLL and Entities on the picture) in the same solution on Visual Studio 2017 (v 15.4.4). I saw this post, but event with .Net version 4.6.2, I still have the problem.

In my .Net core 2.0 project references, I have:

enter image description here

When I try to use a class defined in .Net 4.6.2 projects, I have following error: "Cannot resolve symbole 'BLL'" (for BLL project).

enter image description here

Do you have any idea what to do to use .Net 4.6.2 project in a net core 2.0 project?

2条回答
一夜七次
2楼-- · 2019-01-29 14:30

I got two problems:

  1. As said @Jamie Taylor, I needed to downgrade to .NET Framework 4.6.1 to be compatible with .NET core 2.0.
  2. Because of downgrading, some Nuget packages where conflicting with the .NET Framework version 4.6.1. It was the case of EF 6.2 (which uses .NET Framework 4.6.2). So I downgraded all needed packages then deleted "packages", "bin" and "obj" folders and did a Nuget Restore.
查看更多
甜甜的少女心
3楼-- · 2019-01-29 14:35

As user magicandre1981 said, you should downgrade from .NET Framework version 4.6.2 to 4.6.1.

Taking a look at the .NET Standard version table, you can see that version 4.6.1 is supported by .NET Standard 2.0 (and thus .NET Core 2.0), but 4.6.2 is not listed (therefore not supported).

For those unable to click through, I took the following screen shot of the table presented on the above linked page:

enter image description here

(image is correct as on Nov 17, 2017)

I'd also recommend taking a look through the documentation for the .NET Standard or at the videos that Immo Landwerth (who is the PM in charge of .NET Standard) has put out about it.

查看更多
登录 后发表回答