I'm attempting to move an existing library that currently supports multiple targets: Profile259, .NET 4.5, .NET 4.0 Client Profile and NetCore451 (Win 8.1+). Depending on the target framework there are two sets of direct dependencies I require: Microsoft.Net.Http (PCL and .net 4.0) and Json.NET (all targets).
I've been able to move to specific platform targets such as .NET 4.5, .NET 4.0 CP, .NET 4.6, etc. However, I'm running into issues targeting PCLs.
With the following project.json
"frameworks": {
".NETPortable,Version=v4.5,Profile=Profile259": {
"compilationOptions": { "define": [ "Portable" ] },
"dependencies": {
"Newtonsoft.Json": "8.0.2",
"Microsoft.Net.Http": "2.2.29"
},
"frameworkAssemblies": {
"Microsoft.CSharp": "",
"mscorlib": "",
"System.Collections": "",
"System.ComponentModel": "",
"System.Diagnostics.Debug": "",
"System.Dynamic.Runtime": "",
"System.Globalization": "",
"System.IO": "",
"System.Linq": "",
"System.Linq.Expressions": "",
"System.Linq.Queryable": "",
"System.Net": "",
"System.Net.Primitives": "",
"System.Net.Requests": "",
"System.ObjectModel": "",
"System.Reflection": "",
"System.Reflection.Extensions": "",
"System.Runtime": "",
"System.Runtime.Extensions": "",
"System.Text.Encoding": "",
"System.Text.RegularExpressions": "",
"System.Threading": "",
"System.Threading.Tasks": ""
}
},
"netcore451": {
"dependencies": {
"Newtonsoft.Json": "8.0.2"
},
"frameworkAssemblies": {
"Microsoft.CSharp": "4.0.0",
"mscorlib": "4.0.0",
"System.Collections": "4.0.0",
"System.ComponentModel": "4.0.0",
"System.Diagnostics.Debug": "4.0.0",
"System.Dynamic.Runtime": "4.0.0",
"System.Globalization": "4.0.0",
"System.IO": "4.0.0",
"System.Linq": "4.0.0",
"System.Linq.Expressions": "4.0.0",
"System.Linq.Queryable": "4.0.0",
"System.Net": "4.0.0",
"System.Net.Http": "4.0.0",
"System.Net.Primitives": "4.0.0",
"System.Net.Requests": "4.0.0",
"System.ObjectModel": "4.0.0",
"System.Reflection": "4.0.0",
"System.Reflection.Extensions": "4.0.0",
"System.Runtime": "4.0.10",
"System.Runtime.Extensions": "4.0.0",
"System.Text.Encoding": "4.0.0",
"System.Text.RegularExpressions": "4.0.0",
"System.Threading": "4.0.0",
"System.Threading.Tasks": "4.0.0"
},
"compilationOptions": {
"define": [ "Async", "NETFX_CORE" ]
}
}}
I end up with fun errors such as:
.NETPortable,Version=v4.5,Profile=Profile259 error CS0012: 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'.
.NETCore,Version=v4.5.1 error CS0012: 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'.
I'm able to switch from Profile 259 to Profile111 and remove the dependency on Microsoft.Net.Http which resolves the PCL issue.
For netcore451 if I remove the reference to Json.NET, the system reference issues are resolved, but the library will no longer compile.
Long story short, any guidance on what to try? Or am I at the mercy of the libraries I depend on to make some changes?