Closed xplicit closed 4 years ago
I think this part of the page you linked to is important:
Note that the API version is different from the package version. Package versions are greater than or equal to the highgest API version contained within. The package version represents the maximum API version plus any bugfixes to the library since that API version was introduced.
So, you should reference the 4.1.0-rc2-24027 version of the System.IO package and since the framework is netstandard1.1
, you will get the 4.0.0 version of the System.IO API.
If you really wanted to use the 4.0.0 version of the System.IO package, you would need "imports"
.
What @svick said is correct. Because you've specified "System.IO" : "4.0.0-*"
in your dependencies, you will get version 4.0.0
of the nuget package, which does not support netstandard1.1
(the nuget package was created before we even came up with netstandard
).
looks like dotnet restore
works with version "4.1", but if 4.0 package does not support netstandard at all, why dnu restore
works with this project.json?
If I change System.IO
to System.Net.Http
then I get:
Package System.Net.Http is not compatible with netstandard1.1 when I put : "System.Net.Http" : "4.0.0-*"
And
'Unable to resolve 'System.Net.Http (>=4.1.0-rc2)' for '.NETStandard,Version=v1.1'
If I put 4.1.0-rc2-*
or 4.1.0-*
dnu restore
works fine (only in the first case)
dnu
has not been updated in a long time, so I would be surprised if the restore operation was actually correct, even if the tool didn't give you an error. You might have some luck running it in some places, but old packages are often missing support for some runtimes, or are just missing bug fixes, etc. Like @svick mentioned above, you could technically force NuGet to allow you to use those old packages (using imports
), but you shouldn't do that; you will get errors in some places trying to use old packages.
Can you try this version of System.Net.Http? It supports netstandard1.1
.
https://www.nuget.org/packages/System.Net.Http/4.0.1-rc2-24027
OK, with System.Net.Http
there is a documentation issue on the page https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md It states version 4.1.0
(while should be 4.0.1
)
Version 4.0.1 works with dotnet restore
. I think the issue can be closed
@mellinoe Just FYI: dnu restore
creates correct project.lock.json and it references recent nuget packages from NETStandard.Library
Originally posted https://github.com/dotnet/cli/issues/3532
Steps to reproduce
run
dotnet restore
on the following project.jsonproject.json
Expected behavior
project is restored without errors (see compatibility of
System.IO
with netstandard versions https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md)Actual behavior
Error.
log : Restoring packages for C:\Projects\dotneTest\project.json... warn : Detected package downgrade: System.IO from 4.1.0-rc2-24027 to 4.0.0-- warn : dotneTest (>= 4.0.0) -> NETStandard.Library (>= 1.5.0-rc2-24027) -> System.IO (>= 4.1.0-rc2-24027) warn : dotneTest (>= 4.0.0) -> System.IO (>= 4.0.0) error: Package System.IO 4.0.0 is not compatible with netstandard1.1 (.NETStandard,Version=v1.1). Package System.IO 4.0.0 supports: error: - dotnet (.NETPlatform,Version=v5.0) error: - monoandroid10 (MonoAndroid,Version=v1.0) error: - monotouch10 (MonoTouch,Version=v1.0) error: - net45 (.NETFramework,Version=v4.5) error: - netcore50 (.NETCore,Version=v5.0) error: - win8 (Windows,Version=v8.0) error: - wp8 (WindowsPhone,Version=v8.0) error: - wpa81 (WindowsPhoneApp,Version=v8.1) error: - xamarinios10 (Xamarin.iOS,Version=v1.0) error: - xamarinmac20 (Xamarin.Mac,Version=v2.0) error: One or more packages are incompatible with .NETStandard,Version=v1.1. log : Writing lock file to disk. Path: C:\Projects\dotneTest\project.lock.json log : C:\Projects\dotneTest\project.json log : Restore failed in 1021ms.
Errors in C:\Projects\dotneTest\project.json Package System.IO 4.0.0 is not compatible with netstandard1.1 (.NETStandard,Version=v1.1). Package System.IO 4.0.0 supports:
Environment data
dotnet --info
output:.NET Command Line Tools (1.0.0-preview2-003041)
Product Information: Version: 1.0.0-preview2-003041 Commit SHA-1 hash: cc3d19463d
Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64
Comments
If I run
dnu restore
on the same file it is restored without issues If I change netstandard version to 1.6dotnet restore
shows the same error If I changeSystem.IO
to other packagedotnet restore
shows the same error