I want to build a .net core library that will have platform specific code for doing win32 and osx calls and when compiling the library for each target os, I want to include
You could define a build definition in your project.json
"buildOptions": {
"define": [ "PORTABLE328" ]
}
eg:
{
"frameworks":{
"netstandard1.6":{
"dependencies":{
"NETStandard.Library":"1.6.0",
}
},
".NETPortable,Version=v4.0,Profile=Profile328":{
"buildOptions": {
"define": [ "PORTABLE328" ]
},
"frameworkAssemblies":{
"mscorlib":"",
"System":"",
"System.Core":"",
"System.Net"
}
}
}
}
Now you can conditionally compile against that target:
#if !PORTABLE328
using System.Net.Http;
using System.Threading.Tasks;
// Potentially other namespaces which aren't compatible with Profile 328
#endif
Source