I have a class library on netstandard1.5
, my project.json
is below. When running dotnet build
I get errors like:
The type 'Exception' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
The type 'Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
The type 'Stream' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
In RC1 packages I could reference System.Runtime
and this would be fixed. However now RC2 and I reference NETStandard.Library
that package is included.
I am completely stumped as to why I get these errors.
project.json
{
"version": "1.0.0-*",
"dependencies": {
},
"frameworks": {
"netstandard1.5": {
"imports": [ "dnxcore50", "portable-net45+win8+wp8+wpa81" ],
"dependencies": {
"Enums": { "target": "project" },
"VQViewModels": { "target": "project" },
"NovellLdap2": { "target": "project" },
"DDay": {"target": "project"},
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Xml.XmlSerializer": "4.0.11-rc2-24027",
"System.Data.Common": "4.0.1-rc2-24027",
"System.Diagnostics.TraceSource": "4.0.0-rc2-24027",
"System.Net.Requests": "4.0.11-rc2-24027",
"System.Xml.XmlDocument": "4.0.1-rc2-24027",
"System.Xml.XPath.XmlDocument": "4.0.1-rc2-24027",
"System.Collections.Specialized": "4.0.1-rc2-24027",
"System.Data.SqlClient": "4.1.0-rc2-24027",
"System.Threading.Thread": "4.0.0-rc2-24027",
"System.Collections.NonGeneric": "4.0.1-rc2-24027",
"System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-24027",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Dapper": "1.50.0-rc2",
"FubarCoder.RestSharp.Portable.HttpClient": "3.2.0",
"MailKit": "1.3.0-beta7",
"Npgsql": "3.1.0"
}
}
}
}
I've tried to isolate but I just can't replicate it. The project references are simply libs with classes like below in them, no logic or dependencies
public class Person
{
}
One of your packages is bringing in an mscorlib-based PCL (likely due to your use of "imports":"portable-net45+win8+wp8+wpa81"
) . To resolve that you need to reference "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027". This package enables compat with mscorlib-based PCLs.
Thanks that package did it, after speaking to @davidfowl we highlighted it was FubarCoder.RestSharp.Portable.HttpClient
and the imports
bring in the BCL.
Most helpful comment
One of your packages is bringing in an mscorlib-based PCL (likely due to your use of
"imports":"portable-net45+win8+wp8+wpa81"
) . To resolve that you need to reference "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027". This package enables compat with mscorlib-based PCLs.