Skip to content

Commit 3f477b5

Browse files
author
Ron Petrusha
authored
What's new in .NET Core 2.1 revisions (#5813)
* What's new in .NET Core 2.1 revisions * Corrected case * Fixed sentence fragment. * Addressed review comments
1 parent c4d5c4f commit 3f477b5

File tree

1 file changed

+42
-20
lines changed

1 file changed

+42
-20
lines changed

docs/core/whats-new/dotnet-core-2-1.md

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: What's new in .NET Core 2.1
33
description: Learn about the new features found in .NET Core 2.1.
44
author: rpetrusha
55
ms.author: ronpet
6-
ms.date: 05/30/2018
6+
ms.date: 06/06/2018
77
---
88
# What's new in .NET Core 2.1
99

@@ -13,12 +13,12 @@ ms.date: 05/30/2018
1313
- [Roll forward](#roll-forward)
1414
- [Deployment](#deployment)
1515
- [Windows Compatibility Pack](#windows-compatibility-pack)
16-
- [JIT compiler improvements](#jit-compiler-improvements)
16+
- [JIT compilation improvements](#jit-compiler-improvements)
1717
- [API changes](#api-changes)
1818

1919
## Tooling
2020

21-
The .NET Core 2.1.300 SDK, the tooling included with .NET Core 2.1, includes the following changes and enhancements:
21+
The .NET Core 2.1 SDK (v 2.1.300), the tooling included with .NET Core 2.1, includes the following changes and enhancements:
2222

2323
### Build performance improvements
2424

@@ -43,7 +43,9 @@ A number of tools that were available only on a per project basis using [`Dotnet
4343
```console
4444
dotnet watch -- --verbose build
4545
```
46-
46+
47+
Note the `--` option that precedes the `--verbose` option. It delimits the options passed directly to the `dotnet watch` command from the arguments that are passed to the child `dotnet` process. Without it, the `--verbose` option applies to the `dotnet watch` command, not the `dotnet build` command.
48+
4749
For more information, see [Develop ASP.NET Core apps using dotnet watch](/aspnet/core/tutorials/dotnet-watch)
4850

4951
- `dotnet dev-certs` generates and manages certificates used during development in ASP.NET Core applications.
@@ -66,26 +68,30 @@ dotnet tool install -g dotnetsay
6668

6769
Once installed, the tool can be run from the command line by specifying the tool name. For more information, see [.NET Core Global Tools overview](../tools/global-tools.md).
6870

69-
### Single-source tool management with the `dotnet tool` command
71+
### Tool management with the `dotnet tool` command
72+
73+
In .NET Core SDK 2.1 (v 2.1.300), all tools operations use the `dotnet tool` command. The following options are available:
7074

71-
In .NET Core 2.1, all tools operations use the `dotnet tool` command. The following options are available:
75+
- [`dotnet tool install`](../tools/dotnet-tool-install.md) to install a tool.
7276

73-
- `dotnet tool install` to install a tool.
77+
- [`dotnet tool update`](../tools/dotnet-tool-update.md) to uninstall and reinstall a tool, which effectively updates it.
7478

75-
- `dotnet tool update` to uninstall and reinstall a tool, which effectively updates it.
79+
- [`dotnet tool list`](../tools/dotnet-tool-list.md) to list currently installed tools.
7680

77-
- `dotnet tool list` to list currently installed tools.
81+
- [`dotnet tool uninstall`](../tools/dotnet-tool-uninstall.md) to uninstall currently installed tools.
7882

7983
## Roll forward
8084

81-
All .NET Core applications starting with the .NET Core 2.0 automatically roll forward to the latest *minor version* installed on a system. That is, if the .NET Core version that an application was built with is not present, the application runs against the latest installed minor version. In other words, if an application is built with .NET Core 2.0 and .NET Core 2.0 itself is not present on the host system but .NET Core 2.1 is, the application runs with .NET Core 2.1.
85+
All .NET Core applications starting with the .NET Core 2.0 automatically roll forward to the latest *minor version* installed on a system.
86+
87+
Starting with .NET Core 2.0, if the version of .NET Core that an application was built with is not present at runtime, the application automatically runs against the latest installed *minor version* of .NET Core. In other words, if an application is built with .NET Core 2.0, and .NET Core 2.0 is not present on the host system but .NET Core 2.1 is, the application runs with .NET Core 2.1.
8288

8389
> [!IMPORTANT]
8490
> This roll-forward behavior doesn't apply to preview releases. Nor does it apply to major releases. For example, a .NET Core 1.0 application wouldn't roll forward to .NET Core 2.0 or .NET Core 2.1.
8591
8692
You can also disable minor version roll forward in any of three ways:
8793

88-
- Set the `DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX` environment variable equal to 0,
94+
- Set the `DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX` environment variable to 0.
8995

9096
- Add the following line to the runtimeconfig.json file:
9197

@@ -103,31 +109,43 @@ You can also disable minor version roll forward in any of three ways:
103109

104110
### Self-contained application servicing
105111

106-
`dotnet publish` now publishes self-contained applications with a serviced runtime version. When you publish a self-contained application with the .NET Core 2.1 SDK, your application includes the latest serviced runtime version known by that SDK. When you upgrade to the latest SDK, you’ll publish with the latest .NET Core runtime version. This applies for .NET Core 1.0 runtimes and later.
112+
`dotnet publish` now publishes self-contained applications with a serviced runtime version. When you publish a self-contained application with the .NET Core 2.1 SDK (v 2.1.300), your application includes the latest serviced runtime version known by that SDK. When you upgrade to the latest SDK, you’ll publish with the latest .NET Core runtime version. This applies for .NET Core 1.0 runtimes and later.
107113

108114
Self-contained publishing relies on runtime versions on NuGet.org. You do not need to have the serviced runtime on your machine.
109115

110-
Using the .NET Core 2.0 SDK, self-contained applications are published with the .NET Core 2.0.0 runtime unless a different version is specified via the `RuntimeFrameworkVersion` property. With this new behavior, you’ll no longer need to set this property to select a higher runtime version for a self-contained application. The easiest approach going forward is to always publish with .NET Core 2.1 SDK.
116+
Using the .NET Core 2.0 SDK, self-contained applications are published with the .NET Core 2.0.0 runtime unless a different version is specified via the `RuntimeFrameworkVersion` property. With this new behavior, you’ll no longer need to set this property to select a higher runtime version for a self-contained application. The easiest approach going forward is to always publish with .NET Core 2.1 SDK (v 2.1.300).
111117

112118
## Windows Compatibility Pack
113119

114120
When you port existing code from the .NET Framework to .NET Core, you can use the [Windows Compatibility Pack](https://www.nuget.org/packages/Microsoft.Windows.Compatibility). It provides access to 20,000 more APIs than are available in .NET Core. These APIs include types in the <xref:System.Drawing?displayProperty="nameWithType"> namespace, the <xref:System.Diagnostics.EventLog> class, WMI, Performance Counters, Windows Services, and the Windows registry types and members.
115121

116122
## JIT compiler improvements
117123

118-
.NET Core incorporates a new JIT compiler technology called *tiered compilation* (also known as *adaptive optimization*) that can significantly improve performance.
124+
.NET Core incorporates a new JIT compiler technology called *tiered compilation* (also known as *adaptive optimization*) that can significantly improve performance. Tiered compilation is an opt-in setting.
119125

120126
One of the important tasks performed by the JIT compiler is optimizing code execution. For little-used code paths, however, the compiler may spend more time optimizing code than the runtime spends running unoptimized code. Tiered compilation introduces two stages in JIT compilation:
121127

122128
- A **first tier**, which generates code as quickly as possible.
123129

124130
- A **second tier**, which generates optimized code for those methods that are executed frequently. The second tier of compilation is performed in parallel for enhanced performance.
125131

126-
You can test tiered compilation with a .NET Core 2.1 app by setting the following environment variable:
132+
You can opt into tiered compilation in either of two ways.
127133

128-
```console
129-
COMPlus_TieredCompilation="1"
130-
```
134+
- To use tiered compilation in all projects that use the .NET Core 2.1 SDK, set the following environment variable:
135+
136+
```console
137+
COMPlus_TieredCompilation="1"
138+
```
139+
140+
- To use tiered compilation on a per-project basis, add the `<TieredCompilation>` property to the `<PropertyGroup>` section of the MSBuild project file, as the following example shows:
141+
142+
```xml
143+
<PropertyGroup>
144+
<!-- other property definitions -->
145+
146+
<TieredCompilation>true</TieredCompilation>
147+
</PropertyGroup>
148+
```
131149

132150
## API changes
133151

@@ -187,16 +205,20 @@ The sockets implementation introduced in .NET Core 2.1 has a number of advantage
187205

188206
- A significant performance improvement when compared with the previous implementation.
189207

190-
- Elimination on platform dependencies, which simplifies deployment and servicing.
208+
- Elimination of platform dependencies, which simplifies deployment and servicing.
191209

192210
- Consistent behavior across all .NET Core platforms.
193211

194-
Sockets based on <xref:System.Net.Http.SocketsHttpHandler> is the default implementation in .NET Core 2.1. However, you can configure your application to use the older <xref:System.Net.Http.HttpClientHandler> class by calling the <xref:System.AppContext.SetSwitch%2A?displayProperty="nameWithType"> method:
212+
<xref:System.Net.Http.SocketsHttpHandler> is the default implementation in .NET Core 2.1. However, you can configure your application to use the older <xref:System.Net.Http.HttpClientHandler> class by calling the <xref:System.AppContext.SetSwitch%2A?displayProperty="nameWithType"> method:
195213

196214
```csharp
197215
AppContext.SetSwitch("System.Net.Http.useSocketsHttpHandler", false);
198216
```
199217

218+
```vb
219+
AppContext.SetSwitch("System.Net.Http.useSocketsHttpHandler", False)
220+
```
221+
200222
You can also use an environment variable to opt out of using sockets implementations based on <xref:System.Net.Http.SocketsHttpHandler>. To do this, set the `DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER` to either `false` or 0.
201223

202224
On Windows, you can also choose to use <xref:System.Net.Http.WinHttpHandler?displayProperty=nameWithType>, which relies on a native implementation, or the <xref:System.Net.Http.SocketsHttpHandler> class by passing an instance of the class to the <xref:System.Net.Http.HttpClient> constructor.

0 commit comments

Comments
 (0)