Reputation: 34629
I'm working on one of those new "Class Library (NuGet Package)" projects in Visual Studio. Everything was going fine until the other day it started raising an error about a System.Runtime.Extensions
assembly:
Assembly 'System.Runtime.Extensions' with identity 'System.Runtime.Extensions,
Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' uses 'System.Runtime,
Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher
version than referenced assembly 'System.Runtime' with identity 'System.Runtime,
Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I checked on NuGet and it appears indeed to be true, System.Runtime.Extensions
requires System.Runtime
to be at least 4.0.20.
I tried changing the following line in the "dependencies"
section of my project.json
:
"System.Runtime": "4.0.10-beta-23019",
to "4.0.20-beta-23019"
, but then it tells me that "the type IOException
exists in both System.IO
and System.Runtime
."
What can I do to fix this?
Thanks.
EDIT: Just tried this on a fresh new package project and it seems to be failing as well, so something's up.
Upvotes: 6
Views: 4462
Reputation: 34629
The solution was simply to explicitly specify my dependency on System.Runtime.Extensions
:
"dependencies": {
"System.Collections": "4.0.10-beta-23019",
"System.Linq": "4.0.0-beta-23019",
"System.Threading": "4.0.10-beta-23019",
"System.Runtime": "4.0.10-beta-23019",
"System.Runtime.Extensions": "4.0.0",
"Microsoft.CSharp": "4.0.0-beta-23019"
},
And all that grief because I wanted to use Environment.NewLine
. D'oh.
Upvotes: 1
Reputation: 46661
Try to add it only to .NET Core target frameworks:
{
"dependencies": { },
"frameworks": {
"dotnet": {
"dependencies": {
"Microsoft.CSharp": "4.0.0",
"System.Collections": "4.0.10",
"System.Linq": "4.0.0",
"System.Runtime.Extensions": "4.0.10",
"System.Threading": "4.0.10"
}
}
}
}
Where dnxcore50
is a .NET Core target framework. Could also be dotnet
for example.
Upvotes: 1