Mvc icon indicating copy to clipboard operation
Mvc copied to clipboard

Dependency conflict

Open pantonis opened this issue 10 years ago • 14 comments

I am not sure what is the reason but I am suspecting a Newtonsoft dependency conflict. I have an asp.net core rc2 web app (.net framework) and a class library with entity framework core installed. When I run the app I get following error

An exception of type 'System.IO.FileLoadException' occurred in Microsoft.Extensions.Configuration.FileExtensions.dll but was not handled in user code

Additional information: Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

You can find the app here

https://github.com/pantonis/AspNetRC2EFCore

pantonis avatar May 19 '16 08:05 pantonis

Managed to reproduce it again. Please pull latest changes from repository mentioned above

pantonis avatar May 21 '16 05:05 pantonis

@davidfowl @anurse can you guys take a quick look at this? Should this move to the CLI repo? Or tooling?

Eilon avatar May 22 '16 22:05 Eilon

BTW I set up a quick mtg for Monday to discuss this.

Eilon avatar May 22 '16 22:05 Eilon

@pantonis we looked into this issue and it turns out to be an issue with .NET CLI and NuGet.

I moved the bug to here: https://github.com/dotnet/cli/issues/3205

Thanks, Eilon

Eilon avatar May 23 '16 19:05 Eilon

Is there any workaround? I m currently blocked and cannot start working on my project. Deadlines are pushing me.

Thanks.

pantonis avatar May 23 '16 19:05 pantonis

@pantonis I think that if you wrap the project manually by creating your own project.json that just includes a reference to the bin/*.dll file, you can then reference that from your main app's project.json file. The problem you're encountering here is due to the project type reference, which is where the NuGet/.NET CLI bug gets tripped up and doesn't know which "other" DLLs to grab from the bin folder of the csproj.

Eilon avatar May 24 '16 05:05 Eilon

@Eilon project.json in a .net class library?

pantonis avatar May 24 '16 06:05 pantonis

@pantonis you'd have something like this:

/src/ClassLibrary/
    MyProj.csproj
    packages.config
/src/ClassLibraryWrapped
    project.json (that points to ../ClassLibrary/bin/Release/MyProj.dll)
/src/MyWebSite
    project.json (that points to ClassLibraryWrapped)

Eilon avatar May 24 '16 06:05 Eilon

Thanks.

I have more than 10 class libraries. This will cause me a mess. Please fix the problem as soon as possible because I think the majority of people will have same problem. I already saw a lot of people complaining on the same problems with .csproj and .xproj incompatibilities.

pantonis avatar May 24 '16 06:05 pantonis

@pantonis indeed, I agree this bug is very cumbersome to work around. I recommend adding a comment to https://github.com/dotnet/cli/issues/3205 to further voice your urgency.

Eilon avatar May 24 '16 06:05 Eilon

Hi all, is this problem resolved yet? Thanks.

karthicktv avatar Sep 01 '16 14:09 karthicktv

This f'in ridiculous! I've now spent the entire afternoon trying to understand why a reference added using the "Add Reference" in Visual Studio works, yet simply adding the example same declaration directly in the project.json doesn't.

DaveSlinn avatar Sep 15 '16 21:09 DaveSlinn

@sayedihashimi @BillHiebert @barrytang do you guys know the right place to track the status of this work? The Tooling repo? A CLI repo? Another place?

Eilon avatar Sep 15 '16 23:09 Eilon

Ah, it seems that https://github.com/NuGet/Home/issues/2865 is the right place to track the status of this fix. Please add your thoughts to that issue if they're not already tracked there. Thanks!

Eilon avatar Sep 16 '16 17:09 Eilon