Sdk: TargetFramework inconsistent - netcoreapp2.0 vs netstandard2.0

Created on 1 Aug 2017  Â·  3Comments  Â·  Source: dotnet/sdk

Steps to reproduce

Using net core 2.0 on a MacBook with VSCode, create the helloworld app.
1) dotnet new console -o hwapp
2) Now do the Getting started with .NET Core on macOS
dotnet new sln
dotnet new classlib -o library

Expected behavior

1) netcoreapp2.0
2) netcoreapp2.0

Actual behavior

1) netcoreapp2.0
2) netstandard2.0

Since I'm new with VSCode on the Mac vs Visual Studio on Windows, this might just be a lack of knowledge on my part. Is netstandard2.0 the same as netcoreapp2.0 or did the CLI mess up?

Environment data

dotnet --info output:

Most helpful comment

Is netstandard2.0 the same as netcoreapp2.0

No, it's not the same. netcoreapp2.0 is the framework name for .NET Core 2.0 while netstandard2.0 is the framework name for .NET Standard 2.0. You can create class libraries that target .NET Core 2.0 instead of .NET Standard 2.0, however, this means that these libraries can only be consumed from .NET Core 2.0. By targeting .NET Standard 2.0 these libraries can be used from any .NET implementation (e.g. .NET Framework, .NET Core, Unity, Xamarin, Mono). Since that is much better, the CLI defaults you to netstandard2.0. So why would ever want to target .NET Core? Only if you need access to APIs that aren't standardized yet.

Does this help?

All 3 comments

In a nutshell, netcoreapp2.0 is for apps (like a console application) while netstandard2.0 is for libraries, which can then be consumed by other libraries or platforms, for instance, netcoreapp2.0 or net461.

Is netstandard2.0 the same as netcoreapp2.0

No, it's not the same. netcoreapp2.0 is the framework name for .NET Core 2.0 while netstandard2.0 is the framework name for .NET Standard 2.0. You can create class libraries that target .NET Core 2.0 instead of .NET Standard 2.0, however, this means that these libraries can only be consumed from .NET Core 2.0. By targeting .NET Standard 2.0 these libraries can be used from any .NET implementation (e.g. .NET Framework, .NET Core, Unity, Xamarin, Mono). Since that is much better, the CLI defaults you to netstandard2.0. So why would ever want to target .NET Core? Only if you need access to APIs that aren't standardized yet.

Does this help?

Yes. This is great! Really appreciate it.

Lot’s to learn moving from the Windows world back to Unix and the open source world. Still deciding .Net Core leveraging years of C# vs Node with Typescript.

Thanks again.

Jim

From: Immo Landwerth [mailto:[email protected]]
Sent: Tuesday, August 1, 2017 6:50 PM
To: dotnet/cli cli@noreply.github.com
Cc: jimrand1 jimrand@ix.netcom.com; Author author@noreply.github.com
Subject: Re: [dotnet/cli] TargetFramework inconsistent - netcoreapp2.0 vs netstandard2.0 (#7335)

Is netstandard2.0 the same as netcoreapp2.0

No, it's not the same. netcoreapp2.0 is the framework name for .NET Core 2.0 while netstandard2.0 is the framework name for .NET Standard 2.0. You can create class libraries that target .NET Core 2.0 instead of .NET Standard 2.0, however, this means that these libraries can only be consumed from .NET Core 2.0. By targeting .NET Standard 2.0 these libraries can be used from any .NET implementation (e.g. .NET Framework, .NET Core, Unity, Xamarin, Mono). Since that is much better, the CLI defaults you to netstandard2.0.

Does this help?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/dotnet/cli/issues/7335#issuecomment-319518926 , or mute the thread https://github.com/notifications/unsubscribe-auth/AYSWUqG2VUJMAMcuHQrbDD7fCfYS6g7Jks5sT6uMgaJpZM4OqUSn .

Was this page helpful?
0 / 5 - 0 ratings