Reputation: 1430
On a machine where an older version of this code works just fine, pulling a fresh version of the same project out of source control, running nuget package restore (which writes the project.lock.json
files), then trying to build outputs errors like this:
Error CS1703
Multiple assemblies with equivalent identity have been imported:
'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Runtime.dll' and
'C:\Users\[username]\.dnx\packages\System.Runtime\4.0.0\ref\dotnet\System.Runtime.dll'.
Remove one of the duplicate references.
I understand what it's trying to tell me, System.Runtime.dll
was imported twice. What I don't understand is how to get Visual Studio 2015 to fix it.
The only difference I can find in the project is in the project.lock.json
file. Comparing the working project to the non-working project shows results like this. The working file is on the LEFT:
So, from what I understand, the incorrect lock file on the right is telling NuGet to attempt to use the new .NET Core stuff while the one on the left is saying "Use .NET Framework 4.5"?
The project is using "ASP.NET 5 RC1 Update 1". I am confused about this too, ASP.NET 5 should be using the new .NEt Core stuff and not "Framework 4.5"? If that's the case then the "incorrect" lock file seems correct to me since it targets "ref/dotnet"?
Copying the working project.lock.json
file over the non working one allows the project to build, but this is not a solution to the problem in my book. What is it about this project or machine environment that is causing this to happen? Something, somewhere, needs to be uninstalled? Installed? Changed?
Edit to include project.json:
{
"version": "1.0.0-*",
"description": "Model Class Library",
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": { }
},
"dependencies": {
"EntityFramework.Core": "7.0.0-rc1-final",
"System.ComponentModel.Annotations": "4.0.11-beta-23516"
}
}
Upvotes: 1
Views: 172
Reputation: 47375
Try this:
dnvm use 1.0.0-rc1-final
dnu restore
I suspect that the working project.lock.json file was built against a different runtime version than 1.0.0-rc1-update1.
Upvotes: 1