I'm fairly new to .Net Core, but have made a working Asp.Net Core WebAPI site - now I want to share some code with another project...
- I have Visual Studio 2015 with Update 3 installed.
- I have DotNetCore.1.0.0-VS2015Tools.Preview2.exe installed from here.
I would like to create a shared library (PCL) that can be consumed by two other libraries - it only contains primitive classes/interfaces with no other dependencies. One of the consuming libraries is a new vanilla project targeting "netstandard1.6", the other is an old client library which targets .Net 4.5.2 (I can upgrade this to 4.6.x if I must).
I've been round in circles, and I can't make the netstandard1.6 library reference the PCL - I just get told the types are missing:
Error CS0246: The type or namespace name 'SomeTypeHere' could not be found (are you missing a using directive or an assembly reference?)
The PCL named "ClassLibrary1"'s project.json is auto-generated as:
{
"supports": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.1": {}
}
}
My consuming library project.json is:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0",
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"netstandard1.6": {
"dependencies": {
"ClassLibrary1": {
"target": "project"
}
}
}
}
}
How can I make this work?
EDIT 07/07/2016:
I have made the following solution available, which demonstrates my setup: https://github.com/JonnyWideFoot/netcore-prototype See ExperimentClient::GetLocationAsync for where I would like to use the Contracts Library within the .Net 4.5.2 / 4.6.x Client.