sdk: Dependency conflict when project.json references csproj
Moved from https://github.com/aspnet/Mvc/issues/4680 By @pantonis
Steps to reproduce
Use the app from https://github.com/pantonis/AspNetRC2EFCore
It is a simple web app (project.json) that references a class library (csproj + packages.config) using this syntax:
"frameworks": {
"net46": {
"dependencies": {
"ClassLibrary1": {
"target": "project"
}
}
}
},
Expected behavior
Everything should compile and run.
Actual behavior
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)
Environment data
dotnet --info output:
N/A
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 9
- Comments: 47 (5 by maintainers)
Please fix this asap. I think it is a very important bug and the workaround as described by @Eilon in https://github.com/aspnet/Mvc/issues/4680#issuecomment-221171047 is a little bit messy especially when it involves large projects.
I think 99% of the existing projects out there use .csproj class libraries. So there should be a way of smooth transition to asp.net core. I already saw a lot of people complaining about incompatibilities between .csproj and .xproj.
Thanks.
Are there any non-
project.jsonworkarounds for this?We have a simple ASP.NET Core RC1 web application (with
csprojdependencies) that builds and publishes fine usingmsbuildanddnu, but that we cannot upgrade to ASP.NET Core RTM if there is no way to do command-line builds.I’m on Windows, so any workaround requiring
nugetandmsbuildis fine.+1 Blocker
It’ll be fixed when we move the project files back to csproj.
Our xproj uses project.json, csproj use package.config. No issues.
For all struggling with the
Unable to resolve 'csproj-based-project-name' for '.NETFramework, Version=vX.X'issue, please make surenuget restore <.sln file path>Running msbuild afterwards should succeed.
You should not need to run
dotnet restore, because nuget should write correct project.lock.json.Simply running
nuget restorein a xproj file folder does not work, because it tries to restore packages for the project only and does not see other projects. Seems like a different command is triggered.We have this simple sequence running on CI server just fine. Using nuget 3.5.0.1737 (aka 3.5.0-rc.1) + ASP.NET Core 1.0.1, targeting .NET 4.6.1. Our xproj references several csproj. Not sure if it works if you have a more complicated case like xproj -> csproj -> xproj.
It’s extremely confusing that there seems to be no place that explains this carefully. Hope it helps.
Any solution for this problem? I’m using the latest and still cannot do a dotnet restore with csproj based projects.
You should be able to move your class library to use project.json to define dependencies while still maintaining the csproj file, this should unblock you (and give you other goodness).
See: https://oren.codes/2016/02/08/project-json-all-the-things/
Get Outlook for Androidhttps://aka.ms/ghei36
On Tue, May 24, 2016 at 7:33 AM -0700, “nemenos” <notifications@github.commailto:notifications@github.com> wrote:
Yes, please, fix this asap. This bug is blocking us all
You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://github.com/dotnet/cli/issues/3205#issuecomment-221290318