dotnet restore fails if NETStandardLibrary is missing in the dependency list
mkdir temp
cd temp
dotnet new
:: replace project.json contents with below json.
dotnet restore
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"System.Reflection": "4.0.0"
},
"frameworks": {
"dnxcore50": {}
}
}
@anurse @piotrpMSFT
- If you add this line to the dependencies, then the error turns to a warning
"NETStandard.Library": "1.0.0-rc2-23704"
info : Running restore with 16 concurrent jobs.
info : Restoring packages for e:\clr\git\corert\temp\project.json...
info : All packages are compatible with DNXCore,Version=v5.0.
error: System.Reflection 4.0.0 provides a compile-time reference assembly for System.Reflection on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.IO 4.0.0 provides a compile-time reference assembly for System.IO on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Runtime 4.0.0 provides a compile-time reference assembly for System.Runtime on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Text.Encoding 4.0.0 provides a compile-time reference assembly for System.Text.Encoding on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Threading.Tasks 4.0.0 provides a compile-time reference assembly for System.Threading.Tasks on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: Some packages are not compatible with DNXCore,Version=v5.0 (win7-x64).
error: System.Reflection 4.0.0 provides a compile-time reference assembly for System.Reflection on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.IO 4.0.0 provides a compile-time reference assembly for System.IO on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Runtime 4.0.0 provides a compile-time reference assembly for System.Runtime on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Text.Encoding 4.0.0 provides a compile-time reference assembly for System.Text.Encoding on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: System.Threading.Tasks 4.0.0 provides a compile-time reference assembly for System.Threading.Tasks on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.
error: Some packages are not compatible with DNXCore,Version=v5.0 (win7-x86).
info : Committing restore...
info : Restore failed in 516ms.
That's by design. You need to use either the Standard Library or Microsoft.NETCore.Platforms to bring in the correct runtime dependencies.
@davidfowl, is there anyway this error can be turned into a warning and still be restored like what DNU did?
error: Microsoft.DiaSymReader 1.0.6 is not compatible with DNXCore,Version=v5.0.
error: Some packages are not compatible with DNXCore,Version=v5.0.
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23704",
"Microsoft.DiaSymReader": "1.0.6"
},
"frameworks": {
"dnxcore50": { }
}
}
No. Why are you referencing packages that aren't compatible? What does Microsoft.DiaSymReader work on?
You are right that it is not compatible and we should use one for dnxcore, but I am requesting a workaround. DiasymReader is for net45. DNU was silent about it.
DNU may have been silent but would not have provided a reference to the compiler so it still wouldn't have worked. Your project doesn't even have net45 in it's list of supported frameworks. If you want your project to support net45 by cross-compiling and use DiaSymReader in that version, you need to do something like this:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23704"
},
"frameworks": {
"dnxcore50": { },
"net45": {
"dependencies": {
"Microsoft.DiaSymReader": "1.0.6"
}
}
}
}
@schellap I took a look at the diasymreader package in my local cache and it looks like it uses the old portable style lib folder.
@anurse did DNX have some logic to make this compatible with dnxcore50?
I see the same issue in xunit packages (which were definitely used before) and am able to work around with this in the project.json. You may need net45 instead of net451 there.
"frameworks": {
"dnxcore50": {
"imports": "portable-net451+win8"
}
}
@anurse did DNX have some logic to make this compatible with dnxcore50?
Yes, and the magic was hacky and is now dead. Now the magic must be put in project files :smile:
@davidfowl @schellap should we close this? Seems like the solution is to be explicit about the StdLib and its version in the project.json.
Closing...