Announcing .NET Core 2.0

.NET Core 2.0 is available today as a final release. You can start developing with it at the command line, in your favorite text editor, in Visual Studio 2017 15.3, Visual Studio Code or Visual Studio for Mac. It is ready for production workloads, on your own hardware or your favorite cloud, like Microsoft Azure.

.NET Core 2.0 has been deployed to Azure Web Apps. It is now available in all Azure regions.

.NET Core 2.0 includes major improvements that make .NET Core easier to use and much more capable as a platform. The following improvements are the biggest ones and others are described in the body of this post. Please share feedback and any issues you encounter at dotnet/core #812.

Upgrading Libraries

You do not need to update libraries to .NET Standard 2.0. .NET Standard 1.x versions will be supported forever and are not considered “old” or “stale”. .NET Standard is just a spec, so it doesn’t age in the way that platforms do. In general, libraries should target the lowest version of .NET Standard they can tolerate (for maximum .NET implementation applicability) unless they require APIs in higher versions. If you do want to update libraries, you can do it the same way, either in Visual Studio or directly in the project file, as you can see with the following project file segment that target .NET Standard 2.0.

You can also create libraries that target .NET Core. This is not recommended as a general scenario because .NET Core libraries can only be used by .NET Core applications. They cannot be used by .NET Framework of Xamarin applications, as .NET Standard libraries can (this is why .NET Standard is the recommended target framework for libraries). You should only build .NET Core libraries if you require APIs that are only in .NET Core.

Relationship to .NET Core 1.0 and 1.1 Apps

You can install .NET Core 2.0 on machines with .NET Core 1.0 and 1.1. Your 1.0 and 1.1 applications will continue to use the 1.0 and 1.1 runtimes, respectively. They will not roll forward to the 2.0 runtime unless you explicitly update your apps to do so.

By default, the latest SDK is always used. After installing the .NET Core 2.0 SDK, you will use it for all projects, including 1.0 and 1.1 projects. As stated above, 1.0 and 1.1 projects will still use the 1.0 and 1.1 runtimes, respectively.

You can configure a directory (all the way up to a whole drive) to use a specific SDK by creating a global.json file that specifies a specific .NET Core SDK version. All dotnet uses “under” that file will use that version of the SDK. If you do that, make sure you have that version installed.

.NET Core Runtime Improvements

The .NET Core 2.0 Runtime has the following improvements.

Performance Improvements

There are many performance improvements in .NET Core 2.0. The team published a few posts describing the improvements to the .NET Core Runtime in detail.

.NET Core 2.0 Implements .NET Standard 2.0

We have more than doubled the set of available APIs in .NET Standard from 13k in .NET Standard 1.6 to 32k in .NET Standard 2.0. Most of the added APIs are .NET Framework APIs. These additions make it much easier to port existing code to .NET Standard, and, by extension, to any .NET implementation of .NET Standard, such as .NET Core 2.0 and the upcoming version of Universal Windows Platform (UWP).

Much easier to target Linux as a single operating system

.NET Core 2.0 treats Linux as a single operating system. There is now a single Linux build (per chip architecture) that works on all Linux distros that we’ve tested. Our support so far is specific to glibc-based distros and more specifically Debian- and Red Hat-based Linux distros.

There are other Linux distros that we would like to support, like those that use musl C Standard library, such as Alpine. Alpine will be supported in a later release.

Please tell us if the .NET Core 2.0 Linux build doesn’t work well on your favorite Linux distro.

Similar improvements have been made for Windows and macOS. You can now publish for the following “runtimes”.

Globalization Invariant Mode

.NET Core 2.0 includes a new opt-in globalization mode that provides basic globalization-related functionality that is uniform across operating systems and languages. The benefit of this new mode is its uniformity, distribution size, and the absence of any globalization dependencies.

.NET Core SDK Improvements

The .NET Core SDK 2.0 has the following improvements.

dotnet restore is implicit for commands that require it

The dotnet restore command has been a required set of keystrokes with .NET Core to date. The command installs required project dependencies and some other tasks. It’s easy to forget to type it and the error messages that tell you that you need to type it are not always helpful. It is now implicitly called on your behalf for commands like run, build and publish.

The following example workflow demonstates the absense of a required dotnet restore command:

Reference .NET Framework libraries from .NET Standard

You can now reference .NET Framework libraries from .NET Standard libraries using Visual Studio 2017 15.3. This feature helps you migrate .NET Framework code to .NET Standard or .NET Core over time (start with binaries and then move to source). It is also useful in the case that the source code is no longer accessible or is lost for a .NET Framework library, enabling it to be still be used in new scenarios.

We expect that this feature will be used most commonly from .NET Standard libraries. It also works for .NET Core apps and libraries. They can depend on .NET Framework libraries, too.

The supported scenario is referencing a .NET Framework library that happens to only use types within the .NET Standard API set. Also, it is only supported for libraries that target .NET Framework 4.6.1 or earlier (even .NET Framework 1.0 is fine). If the .NET Framework library you reference relies on WPF, the library will not work (or at least not in all cases). You can use libraries that depend on additional APIs,but not for the codepaths you use. In that case, you will need to invest singificantly in testing.

You can see this feature in use in the following images.

The call stack for this app makes the dependency from .NET Core to .NET Standard to .NET Framework more obvious.

.NET Standard NuGet Packages no longer have required dependencies

.NET Standard NuGet packages no longer have any required dependencies if they target .NET Standard 2.0 or later. The .NET Standard dependency is now provided by the .NET Core SDK. It isn’t necessary as a NuGet artifact.

The following is an example nuspec (recipe for a NuGet package) targeting .NET Standard 2.0.

Visual Studio 2017 version 15.3 updates

Side-by-Side SDKs

Visual Studio now has the ability to recognize the install of an updated .NET Core SDK and light up corresponding tooling within Visual Studio. With 15.3, Visual Studio now provides side-by-side support for .NET Core SDKs and defaults to utilizing the highest version installed in the machine when creating new projects while giving you the flexibility to specify and use older versions if needed, via the use of global.json file. Thus, a single version of Visual Studio can now build projects that target different versions of .NET Core.

Support for Visual Basic

In addition to supporting C# and F#, 15.3 now also supports using Visual Basic to develop .NET Core apps. Our aim with Visual Basic this release was to enable .NET Standard 2.0 class libraries. This means Visual Basic only offers templates for class libraries and console apps at this time, while C# and F# also include templates for ASP.NET Core 2.0 apps. Keep an eye on this blog for updates.

Live Unit Testing Support

Live Unit Testing (LUT) is a new feature we introduced in Visual Studio 2017 enterprise edition and with 15.3 it now supports .NET Core. Users who are passionate with Test Driven Development (TDD) will certainly love this new addition. Starting LUT is as simple as turning it ON from the menu bar: Test->Live Unit Testing->Start.

When you enable LUT, you will get unit test coverage and pass/fail feedback live in the code editor as you type. Notice the green ticks and red x’s shown in the code editor in image below.

With regards to navigation improvements, we’ve added support for camelCase matching in GoToAll (Ctrl+T), so that you can navigate to any file/type/member/symbol declaration just by typing cases (e.g., “bh” for “BusHelpers.cs”). You’ll also notice suggested variable names (Fig.2) as you are typing (which will adhere to any code style configured in your team’s EditorConfig).

We’ve added a handful of new refactorings including:

Resolve merge conflict

Add parameter (from callsite)

Generate overrides

Add named argument

Add null-check for parameters

Insert digit-separators into literals

Change base for numeric literals (e.g., hex to binary)

Convert if-to-switch

Remove unused variable

Project System simplifications

We further simplified the .csproj project file by removing some unnecessary elements that were confusing to users and wherever possible we now derive them implicitly. Simplification trickles down to Solution Explorer view as well. Nodes in Solution Explorer are now neatly organized into categories within the Dependencies node, like NuGet, project-to-project references, SDK, etc.

Another enhancement made to the .NET Core project system is that it is now more efficient when it comes to builds. If nothing changed and the project appears to be up to date since the last build, then it won’t waste build cycles.

Docker

Several important improvements were made to .NET Core support for Docker during the 2.0 project.

Support and Lifecycle

.NET Core 2.0 is a new release, supported by Microsoft . You can start using it immediately for development and production.

Microsoft has two support levels: Long Term Support (LTS) and Current release. LTS releases have three years of support and Current releases are shorter, typically around a year, but potentially shorter. .NET Core 1.0 and 1.1 are LTS releases. You can read more about these support levels in the .NET Support and Versioning post. In that post, “Current” releases are referred to as “Fast Track Support”.

.NET Core 2.0 is a Current release. We are waiting to get your feedback on quality and reliability before switching to LTS support. In general, we want to make sure that LTS releases are at the stage where we only need to provide security fixes for them. Once you deploy an app with an LTS release, you shouldn’t have to update it much, at least not due to platform updates.

.NET Core 1.1

.NET Core 1.0 and 1.1 will both go out of support on June 27, 2019 or 12 months after the .NET Core 2.0 LTS release, whichever is shorter.

We recommend that all 1.0 customers move to 1.1, if not to 2.0. .NET Core 1.1 has important usability fixes in it that make for a significantly better development experience than 1.0.

Red Hat

Red Hat also provides full support for .NET Core on RHEL and will be providing a distribution of .NET Core 2.0 very soon. We’re excited to see our partners like Red Hat follow our release so quickly. For more information head to RedHatLoves.NET.

Closing

We’re very excited on this significant milestone for .NET Core. Not only is the 2.0 release our fastest version of .NET ever, the .NET Standard 2.0 delivers on the promise of .NET everywhere. In conjunction with the Visual Studio family, .NET Core provides the most productive development platform for developers using MacOS or Linux as well as Windows. We encourage you to download the latest .NET Core SDK from https://dot.net/core and start working with this new version of .NET Core.

Amazing work, and congrats to the team. I started using .Net Core 1.1 around two months ago for daily Web/API development and haven’t looked back since. The platform and tooling are superb, not to mention the small but much appreciated language updates in C# 7.0.

It’s hard to go back to using Unity when I’m doing client work. At least 2017.1 brings us .Net 4.6/C# 6.0.

I am impressed. Great news! Net Core is great idea in and I believe .Net Core 2.0 will make it practically useful and on par with development experience which we had in full framework, now with so many opportunities. Thanks for making it happen.

I realise what a silly thing it is to ask for timelines, sometimes, but when you say “close”, do you mean “this calendar year”? That would align with some other efforts I have progressing at the moment.

We are about to invest more in unit testing / code coverage. My understanding is that some scenarios work and are just poorly documented. I’ll ping folks to get them to look at code coverage in particular. Feel free to mail me at rlander@ms if you want to be first of the list to get that info.

Thanks. More on that is that code coverage with dotnet test (without visual studio) doesn’t work, and only can be done through Visual Studio. It requires us to manually check code coverage during code review and prevents us from getting code coverage from command line and publish it to TFS, which we use for reports, rejection of patches, etc.

I installed VS2017 15.3 update and then downloaded and installed .NET Core 2.0 SDK (both x64 and x86). I restarted my machine and opened VS 2017 to create a new ASP.NET Core 2.0 website, however, VS 2017 only allows me to select .NET Core 1.0 or 1.1 BUT not v2.0 even I installed the SDK! VS states something like “A new .NET Core 2.0 is available to install” in that same dialog BUT I already have it installed! What could be the problem? Thanks,

That sounds odd to me. Can you double check in VS that you are using 15.3? Sometimes people have more than one version of Visual Studio 2017 installed. This has happened to me.

1 year ago

Gabriel

Thanks for the quick response Rich! Yes, it sounds odd to me too… The about dialog from my VS 2017 Community states Version 15.3.2 and the following screenshot is what I see when trying to create an ASP.NET Core website https://s29.postimg.org/7kzjdajon/vs2017.png

Oh, you are the one who has been downloading our daily builds! Joke. Thanks for playing along as part of the release. I can imagine that you are happy to get on stable builds, for sure. Please do install a few .NET Core 2.1 builds after the development team comes back from “post 2.0 vacation”!

Congratulations! This is a most impressive release and significantly raises the bar for .Net Core.

Now that 2.0 is final, could you please share plans for upcoming versions?
I am most hopeful for a solid GUI solution, ideally WPF.
Server-side web and console applications are now covered well, but there is unfortunately little support for regular GUI applications.
Most of my customers require some form of (non-browser) GUI, which makes it difficult to go with complete .Net Core solution.
(I’m not interested in Xamarin. It is quite inferior to WPF in nearly all ways.)

Thanks much. I hope that we can raise the bar again with future releases. This one was indeed a big one.

We don’t have anything to share yet on GUI apps. There are a lot of GUI solutions available, particularly from the Mono ecosystem. Those have all been waiting to be ported to .NET Core, waiting for the 2.0-based API surface area. At the very least, I suspect that we’ll see a number of community-based solutions show up. I suspect you want a Microsoft-provided one. It may seem like we’ve got everything in good shape with 2.0 but we have a significant set of fundamentals features left to build before we get into the GUI space. On that note, I’ll post the .NET Core 2.1 roadmap doc soon.

I also want GUI solution from microsoft with good drag&drop designer like winforms/wpf. easy to use, cross-platform and web (webassembly). Hope you can focus on GUI soon and surprise us with something great.

You can uninstall pre-release versions, but it doesn’t matter much. It is perfectly safe to leave them there. Most of the people of the .NET Core team don’t bother deleting old versions. They just take up disk space and not used.

Hi Rambalac,
Have you tried to add to add .NET Core Tool Installer (Preview) task on top of your build and
set “Version” to 2.0.0 and “Package to install” to SDK
we had some troubles with restore also, and this workaround help us

1 year ago

Rambalac

Just solved it. I did have .NET Core Tool Installer (Preview) task. But it should be install “SDK”, not just “Runtime”.

> With regards to navigation improvements, we’ve added support for camelCase matching in GoToAll (Ctrl+T), so that you can navigate to any file/type/member/symbol declaration just by typing cases (e.g., “bh” for “BusHelpers.cs”).

This is great! Something that’s been common in many other editors (Sublime Text, Rider, …). I just don’t understand why this only works in GoToAll and not in normal autocomplete as well. Would be very helpful!

“Reference .NET Framework libraries from .NET Standard” – Will this work for .NET core apps running on *nix? Or only on Windows? (I.e. we build an app in .NET Core 2.0, reference some old Nuget packages, and run it on Linux.)

Hi Oren: I wrote the sample code for this and can share with you if you want. Shoot me an email at jomorris@microsoft.com. RegisterWorkOut() is exercised by 8 unit tests and one of the unit tests (TestTweetifyNoNotes()) is failing. Sample was written that way to demonstrate a unit test failure. If any one of the exercised unit test fails, then coverage icon is marked with a red cross. You can watch my video that explains Live Unit Testing feature at https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/T105

Good work. working on stable version is more convincing than the preview-1, preview-2. I have some doubt though.
1) Few days back, I have created solution and was trying to understand Microsoft.AspnetCore.All 2.0.0-preview2-final. It has good implementation and breaking changes w.r.t. ConfigureServices(IServiceCollection services) and Configure(IApplicationBuilder app, IHostingEnvironment env) for Identity and Authentication implementation.
Team was suggesting to use services.AddCookingAuthentication() and other. and use app.UseAuthentication();

But when I have upgrade the version just few minutes back to stable 2.0, I got an error message. Is that something removed or not committed as a part of stable 2.0?

In 15.3 the 2.0 SDK needs to be installed as a separate download https://www.microsoft.com/net/download/core which will then lightup 2.0 development in Visual Studio. It will be bundled into the Visual Studio installer in a future update.

Lots of nice things if we moved fully to .net core. But in the meantime please add some of these things to other project types.

For example, a Xamarin project I have doesn’t show the nice Project System layout simplifications that you show here even though I am using PackageReference style. Feels like that would be an easily transferred bit of functionality that would benefit many customers.

Correct. Only one direction is support: core -> framework. This direction is supported as a kind of “likely to work opt-in experience” that is intended to ease transition to .NET Standard. It isn’t indicative of a new direction of “everything can reference everything”. If you have libraries that you want to work for multiple implementations, then you should build .NET Standard libraries. That’s exactly what they are for.

So just to make sure I am parsing this correctly: “If you have libraries that you want to work for multiple implementations, then you should build .NET Standard libraries. That’s exactly what they are for.”

I read that as: “If I am creating a new library that I want to work on Windows, Linux, etc., .Net Standard 2.0 is the correct choice”. Is that accurate?

Not exactly. .NET Standard isn’t primarily about operating system breadth. It is about .NET implementation breadth, which happens only as a side-effect to give you operating system breadth. So, if you want a library to have applicability to .NET Framework, .NET Core and Xamarin, then .NET Standard is the right tool for the job. If you want a library to be solely used for .NET Core on Windows, macOS and Linux, then targeting .NET Core (netcoreapp) is fine. That said, we recommend you target .NET Standard if your library can fit within its API set because it gives you both .NET implementation and operating system applicability, which is a very nice characteristic.

“Nodes in Solution Explorer are now neatly organized into categories within the Dependencies node, like NuGet, project-to-project references, SDK, etc.” This is a great improvement over the current Projects organization. Can we expect (and when) a such organization for full .NET Framework projects (WPF, …)? Thanks.

Nice changes and I like that it is available in Azure already!!
Small question, when will it become available in VSTS, because I can’t use it their yet and because of that I can’t deploy to azure from VSTS.
I might do a manual deploy in the mean time but would be nice to see it working from VSTS!

I was on the team in .NET Framework 2.0. Was my first .NET release, actually. It does feel similar. And of course, the prior release was 1.1 in both cases. I think .NET Framework 2.0 was actually a fair bit bigger (generics, X64, much much higher quality). When you add 2.0 and the next couple minor releases together, we’ll be there. More fun stuff coming!

> .NET Core 1.0 and 1.1 will both go out of support on June 27, 2019 or 12 months after the .NET Core 2.0 LTS release, whichever is shorter.

You mean “longer”, right? What is the point of LTS when you promised users it will be supported long term but releasing the next non-compatible version shortens it? That goes against the idea of LTS how I understand the term.

The lifecycle is for free support. You can always call Microsoft Support for paid support after this period.

We do want developers to move forward to new versions. That’s why we created a lifecycle with variable length. We thought that 1 year was enough time to move forward to stay within free support. We discussed this with a number of customers who were happy with the plan.

We are working on making it easier to move forward to new .NET Core versions. It will get easier with each version. Your apps will get faster, scale better and be more secure.

// Check for the correct attribute. Do not inspect attributes of any superclasses.
IEnumerable attribs = mi.GetCustomAttributes(false);
bool found = false;
foreach (Attribute attrib in attribs)
{
// We must find at least one instance of the right type.
if (attrib.GetType() == attributeType)
{
found = true;
break;
}
}

return found;
}

Pretty simple enumerator scanning the attributes, if any, and returning true if the “right” one was found. However, when targeting NET Core 2.0 (but not when targeting .NET Core 1.1), the wrong version of mi.GetCustomAttributes(false); is being selected. The version returning object[] is used, rather than the extension method returning IEnumerable. This results in a build error. Thoughts on what I should do about this? 😉

After updating to dotnet core 2.0 yesterday, the execution(dotnet run) process took long time than before. It’s just ‘hello world’ program and took around 2 seconds to execute it in command prompt. It was faster before.

Hi, I installed VS2017 15.3.5 and then installed .NET Core 2.0 SDK (x64) on Windows 10. After installations, I rebooted my computer and opened VS 2017. But VS 2017 only lists .NET Core 1.0 or 1.1. I don’t see 2.0 on the list. VS2017 indicates “A new .NET Core 2.0 is available to install”. I have tried many time to reinstall VS2017 and .NET Core 2.0. Both are most updated versions. Also, I tried to uninstalled some old programs which may be related with VS and frameworks. But the problem is still there. Please help.
Thanks,

Is there any equivalent to the full set of properties that the TestContext class exposes in NetFx version of the MStest.TestFramework 1.2.1 package in the netstandard version? I only see a couple methods and properties on it, like WriteLine() and TestName.