.Net Core Class project issue from .Net Core Console application

I'm new to .Net Core, and I had a problem trying to reference the .Net Core Class build project from my .Net Core Console Application. This is a very similar question to this question , however the answers here did not help me.

I am using Visual Studio 2015 update 3

I am using ReSharper Ultimate 2016.1.2

I am using .Net Core 1.0.0 Preview 2 (RC2)

. Core Core Class Project

Class1.cs

namespace ClassLibrary1
{
    public class Class1
    {
        public void Foo()
        {
            Console.WriteLine("Foo");
        }
    }
}

project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

. Core Core Console Project

Program.cs

using System;
using ClassLibrary1;

namespace ConsoleApplication
{
    public class Program
    {
        Class1.Foo();
    }
}

project.json

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0"
    },
    "ClassLibrary1": "1.0.0-*"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}

ClassLibrary1 ConsoleApplication, , project.json ConsoleApplication, , , . ClassLibrary1.Class1.Foo(); Visual Studio , .

ReSharper , , , .

, , , ReSharper , Visual Studio , ReSharper.

Class1 project.json netstandard1.6 netcoreapp, , , , ConsoleApplication, , , netcoreapp - , , netstandard ?

- ?

Hacked ClassLibrary1/project.json(, ?)

{
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}
+4

Source: https://habr.com/ru/post/1649013/


All Articles