相关文章推荐
卖萌的水桶  ·  Vue ...·  2 年前    · 
热心的皮蛋  ·  Microsoft office ...·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am working on an ASP.Net core 2.1 web app project. I have 1 project in my solution and 3 other libraries, it's and advanced architecture (data access layer ( DAL ), business layer ( BL ), common layer ( CL )), so i need to add references to connect some libraries and project. I have added CL reference to my project and to libraries DAL and BL . Now I have to add reference BL to my project, but when I add I get this type of error:

Version conflict detected fr Microsoft.EntityFrameworkCore/ Install/reference Microsoft.EntityFrameworkCore 2.2.1 directly to project 'WEB' to resolve this issue

When I am trying to install that version it says

Package restore failed. Rolling back package changes for 'WEB'

I can also mention that when I add reference BL to my project, it also includes DAL , and CL itself, (and DAL contains Microsoft.EntityFrameworkCore (2.2.1), can't understand what's the problem, any ideas?

Additional Images of the problem in here .

project.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CL\CL.csproj" />
</ItemGroup>
</Project>

i have added CL reference as you can see, now i want to add BL reference and get this error

Toy should also show us the csproj files. There's nowhere near enough information here to answer the question. – DavidG Jan 21, 2019 at 10:25 Its very clear from the error message that you've to install Microsoft.EntityFrameworkCore.Abstractions 2.2.1 to web before installing the other project – Aman B Jan 21, 2019 at 11:03 @Artur_Kamalyan post the actual errors, not images of the errors. The Package Manager output window should explain which packages caused the conflict. Post the PackageReference elements from your csproj file, not images of the packages. The new csproj file format is so clean that you should be able to find them easily – Panagiotis Kanavos Jan 21, 2019 at 11:03

The issue is because you're having local directory path to one of your {projectName}.csproj file Kindly review your .csproj files by Right clicking project and select Edit {projectName}.scproj

<Reference Include="Microsoft.EntityFrameworkCore">
      <HintPath>..\..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\Microsoft.EntityFrameworkCore\2.1.1\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll</HintPath>
    </Reference>

If yes than go to Nuget Package Manager and add your library bu selecting nuget.org as Package Source

after restoring from nuget Package manager csproject file will have following tag Added

<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.1" />

Here {projectName} is the name of C# project.

imgur.com/a/3cuMG8o, this is my Project.csproj , it only contains Microsoft.AspNetCore.App when i'm trying to install Microsoft.EntityFrameworkCore 2.2.1 it should automatically add PackageReference to Project.csproj, but installation fails everytime – Artur_Kamalyan Jan 21, 2019 at 14:21 @Artur_Kamalyan those links return a 404. Why don't you just post the code in the question? It takes less time than uploading an image only to lose it and have to upload it again – Panagiotis Kanavos Jan 21, 2019 at 14:48 @PanagiotisKanavos i can't upload images as i dont have +15 reputation, that's why i used to show them in that way, can you check the question now sir – Artur_Kamalyan Jan 21, 2019 at 14:58 Can you please clarify this part: "If yes than go to Nuget Package Manager and add your library bu selecting nuget.org as Package Source after restoring from nuget Package manager csproject file will have following tag Added to". Im going to Manage nuget packages for the project which contains the HintPath but it already has nuget.org as Package Source? And how do i "restore from nuget package manager"? Thanks. – jagge123 Jun 6, 2019 at 22:31

Just want to chip in that i had the same issue but with EntityFrameworkCore 3.0 preview. I solved it by simply downgrading all entityframework 3.0(preview) nuget packages to latest stable (2.2).

Hopefully this helps someone aswell, took me hours...

Option 1 check visual studio error window and identify which package is making the conflict . make sure both packages have save version code

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.