Pujubuju
Pujubuju

Reputation: 119

What's difference between .NetCoreApp and .NetStandard.Library?

.Net Core 1.0 has been released couple days ago, and i've started playing with it. I've created simple solution, with one project (class library => .NetStandard.Library) and second, console application (.NetCoreApp). The point is, console application has reference to library, but i cant use types form that library. Are those two frameworks incompatible? Am i missing something?

project.json for console application:

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

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

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

project.json for library:

{
  "version": "1.0.0-*",

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

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

I've figured it out, that it works, and code compiles, but visual studio still highlights types from library as unknown.

Upvotes: 4

Views: 5027

Answers (4)

Dan H
Dan H

Reputation: 1828

I had the same issue and it turned out I needed to update Resharper to it's latest version. I had v9.1.1 so I updated it to 2016.3.2 and that fixed the issue.

Upvotes: 0

hB0
hB0

Reputation: 2037

.NetCoreApp is a platform and .NetStandard.Library is a library supposed to be cross platform (portable class library) for various .NET platforms runtimes.

You can include a direct reference (package) of NetStandard.Library in any of your .NET platform project that is supported, for ex .NETCoreApp (Dot Net Core 1.X)

Reference: https://learn.microsoft.com/en-us/dotnet/articles/standard/library

Upvotes: 1

Pujubuju
Pujubuju

Reputation: 119

Ok, it's strange, but after disabling resharper, restarting VS and rebuilding solution, it works fine. It seems there is prolem with resharper support for .net core. (resharper v.9.1.3). From this: resharper ultimate blog i understand that only ultimate version supports .net core for now.

Upvotes: 1

svick
svick

Reputation: 244757

The most likely issue is that .Net Core is expecting ConsoleApplicationLibrary to be a NuGet package. If you want to reference a project, use "ConsoleApplicationLibrary": {"target": "project", "version": "1.0.0-*"}.

After you do that, don't forget to restore packages.

Upvotes: 1

Related Questions