I have 2 problem.
In short:
1. problem 1, use the .NET core from a full framework app
2. write a .NET Core app which target platform specific code
Problem 1
see
"what I have tried"
Problem 2
I don't have any code to show here.
But at work we target Android, iOS and .NET SDK using PCL. I was wondering if can write a .NET Core library that somehow get to use platform specific implementation of whatever feature... I am not sure how to go about it....
What I have tried:
Problem 1:
I have 2 very simple projects.
A .NET Core library as follow (whole source code)
namespace ClassCoreLib1
{
public static class Class1
{
public static string Answer() { return "42"; }
}
}
and a .NET 4.5.2 console app as follow (whole source code)
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var s = ClassCoreLib1.Class1.Answer();
Console.WriteLine(s);
}
}
}
Now I try, as you can see to use the .NET Core library with the full .NET framework console app
I did modified the .NET Core library's
project.json
as follow, I added:
"net451": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1"
}
And it did create a .NET output folder and when I study the .DLL inside it it seems to depends on
mscorlib
from the GAC, .NET 4.5.1, so it should be right, I think...
Now... if I copy the .DLL in the net452 output folder outside the ClassCoreLib folder.. then
I am able to link against it and run! Yahoo! :)
However I can't compile by linking against the project or even directly referencing the .dll by its path
"..\..\src\ClassCoreLib1\bin\Debug\net451\ClassCoreLib1.dll"
fails to compile...
Summary
Having to copy the .dll after each successfull build is quite unproductive and error prone.... I wonder if there is a better solution?