From 96bc2b808575353e5353757765acd2cd4216dee5 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Mon, 11 Jun 2018 09:11:04 +0800 Subject: [PATCH 01/10] Fix a typo in memory-mapped-files.md (#5897) --- docs/standard/io/memory-mapped-files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/io/memory-mapped-files.md b/docs/standard/io/memory-mapped-files.md index 34850ebcf8191..7fb94ee158006 100644 --- a/docs/standard/io/memory-mapped-files.md +++ b/docs/standard/io/memory-mapped-files.md @@ -7,7 +7,7 @@ dev_langs: - "vb" helpviewer_keywords: - "memory-mapped files" - - "inter-process communiation" + - "inter-process communication" ms.assetid: a483d1b5-64aa-45b6-86ef-11b859f7f02e author: "mairaw" ms.author: "mairaw" From d6fa1edc317c42d9fc246b590c2dc71c27b9e5a7 Mon Sep 17 00:00:00 2001 From: Ron Petrusha Date: Sun, 10 Jun 2018 23:17:27 -0700 Subject: [PATCH 02/10] Modified Standard numeric format strings topic (#5814) * Modifed recommended use of G9 * Made C# examples interactive * Added include file, addressed comments * Removed unnecessary include * Corrected typo --- .../standard-numeric-format-strings.md | 46 +++++++++++-------- .../csharp-interactive-with-culture-note.md | 6 +++ 2 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 includes/csharp-interactive-with-culture-note.md diff --git a/docs/standard/base-types/standard-numeric-format-strings.md b/docs/standard/base-types/standard-numeric-format-strings.md index fc35e286f995b..e875cab525a42 100644 --- a/docs/standard/base-types/standard-numeric-format-strings.md +++ b/docs/standard/base-types/standard-numeric-format-strings.md @@ -1,6 +1,6 @@ --- title: "Standard Numeric Format Strings" -ms.date: "09/10/2017" +ms.date: "06/10/2018" ms.technology: dotnet-standard dev_langs: - "csharp" @@ -20,6 +20,7 @@ author: "rpetrusha" ms.author: "ronpet" --- # Standard Numeric Format Strings + Standard numeric format strings are used to format common numeric types. A standard numeric format string takes the form `Axx`, where: - `A` is a single alphabetic character called the *format specifier*. Any numeric format string that contains more than one alphabetic character, including white space, is interpreted as a custom numeric format string. For more information, see [Custom Numeric Format Strings](../../../docs/standard/base-types/custom-numeric-format-strings.md). @@ -59,24 +60,27 @@ Standard numeric format strings are supported by: ## Using Standard Numeric Format Strings - A standard numeric format string can be used to define the formatting of a numeric value in one of two ways: + +[!INCLUDE[interactive-note](~/includes/csharp-interactive-with-culture-note.md)] + +A standard numeric format string can be used to define the formatting of a numeric value in one of two ways: - It can be passed to an overload of the `ToString` method that has a `format` parameter. The following example formats a numeric value as a currency string in the current culture (in this case, the en-US culture). [!code-cpp[Formatting.Numeric.Standard#10](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/standardusage1.cpp#10)] - [!code-csharp[Formatting.Numeric.Standard#10](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs#10)] + [!code-csharp-interactive[Formatting.Numeric.Standard#10](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs#10)] [!code-vb[Formatting.Numeric.Standard#10](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/standardusage1.vb#10)] - It can be supplied as the `formatString` argument in a format item used with such methods as , , and . For more information, see [Composite Formatting](../../../docs/standard/base-types/composite-formatting.md). The following example uses a format item to insert a currency value in a string. [!code-cpp[Formatting.Numeric.Standard#11](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/standardusage1.cpp#11)] - [!code-csharp[Formatting.Numeric.Standard#11](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs#11)] + [!code-csharp-interactive[Formatting.Numeric.Standard#11](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs#11)] [!code-vb[Formatting.Numeric.Standard#11](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/standardusage1.vb#11)] Optionally, you can supply an `alignment` argument to specify the width of the numeric field and whether its value is right- or left-aligned. The following example left-aligns a currency value in a 28-character field, and it right-aligns a currency value in a 14-character field. [!code-cpp[Formatting.Numeric.Standard#12](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/standardusage1.cpp#12)] - [!code-csharp[Formatting.Numeric.Standard#12](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs#12)] + [!code-csharp-interactive[Formatting.Numeric.Standard#12](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs#12)] [!code-vb[Formatting.Numeric.Standard#12](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/standardusage1.vb#12)] - It can be supplied as the `formatString` argument in an interpolated expression item of an interpolated string. For more information, see the [String interpolation](../../csharp/language-reference/tokens/interpolated.md) topic in the C# reference or the [Interpolated strings](../../visual-basic/programming-guide/language-features/strings/interpolated-strings.md) topic in the Visual Basic reference. @@ -105,7 +109,7 @@ Standard numeric format strings are supported by: The following example formats a value with the currency format specifier. [!code-cpp[Formatting.Numeric.Standard#1](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#1)] - [!code-csharp[Formatting.Numeric.Standard#1](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#1)] + [!code-csharp-interactive[Formatting.Numeric.Standard#1](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#1)] [!code-vb[Formatting.Numeric.Standard#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#1)] [Back to table](#table) @@ -125,7 +129,7 @@ Standard numeric format strings are supported by: The following example formats an value with the decimal format specifier. [!code-cpp[Formatting.Numeric.Standard#2](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#2)] - [!code-csharp[Formatting.Numeric.Standard#2](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#2)] + [!code-csharp-interactive[Formatting.Numeric.Standard#2](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#2)] [!code-vb[Formatting.Numeric.Standard#2](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#2)] [Back to table](#table) @@ -149,7 +153,7 @@ Standard numeric format strings are supported by: The following example formats a value with the exponential format specifier. [!code-cpp[Formatting.Numeric.Standard#3](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#3)] - [!code-csharp[Formatting.Numeric.Standard#3](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#3)] + [!code-csharp-interactive[Formatting.Numeric.Standard#3](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#3)] [!code-vb[Formatting.Numeric.Standard#3](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#3)] [Back to table](#table) @@ -171,7 +175,7 @@ Standard numeric format strings are supported by: The following example formats a and an value with the fixed-point format specifier. [!code-cpp[Formatting.Numeric.Standard#4](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#4)] - [!code-csharp[Formatting.Numeric.Standard#4](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#4)] + [!code-csharp-interactive[Formatting.Numeric.Standard#4](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#4)] [!code-vb[Formatting.Numeric.Standard#4](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#4)] [Back to table](#table) @@ -200,10 +204,10 @@ Standard numeric format strings are supported by: Note that, when used with a value, the "G17" format specifier ensures that the original value successfully round-trips. This is because is an IEEE 754-2008-compliant double-precision (`binary64`) floating point number that gives up to 17 significant digits of precision. We recommend its use instead of the ["R" format specifier](#RFormatString), since in some cases "R" fails to successfully round-trip double-precision floating point values. The following example illustrates one such case. -[!code-csharp[Round-tripping a Double](../../../samples/snippets/standard/base-types/format-strings/csharp/g17.cs)] +[!code-csharp-interactive[Round-tripping a Double](../../../samples/snippets/standard/base-types/format-strings/csharp/g17.cs)] [!code-vb[Round-tripping a Double](../../../samples/snippets/standard/base-types/format-strings/vb/g17.vb)] -When used with a value, the "G9" format specifier ensures that the original value successfully round-trips. This is because is an IEEE 754-2008-compliant single-precision (`binary32`) floating point number that gives up to nine significant digits of precision. We recommend its use instead of the ["R" format specifier](#RFormatString), since in some cases "R" fails to successfully round-trip single-precision floating point values. +When used with a value, the "G9" format specifier ensures that the original value successfully round-trips. This is because is an IEEE 754-2008-compliant single-precision (`binary32`) floating point number that gives up to nine significant digits of precision. For performance reasons, we recommend its use instead of the ["R" format specifier](#RFormatString). The result string is affected by the formatting information of the current object. The following table lists the properties that control the formatting of the result string. @@ -216,7 +220,7 @@ When used with a value, the "G9" format specifier ensures t The following example formats assorted floating-point values with the general format specifier. [!code-cpp[Formatting.Numeric.Standard#5](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#5)] - [!code-csharp[Formatting.Numeric.Standard#5](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#5)] + [!code-csharp-interactive[Formatting.Numeric.Standard#5](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#5)] [!code-vb[Formatting.Numeric.Standard#5](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#5)] [Back to table](#table) @@ -239,7 +243,7 @@ When used with a value, the "G9" format specifier ensures t The following example formats assorted floating-point values with the number format specifier. [!code-cpp[Formatting.Numeric.Standard#6](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#6)] - [!code-csharp[Formatting.Numeric.Standard#6](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#6)] + [!code-csharp-interactive[Formatting.Numeric.Standard#6](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#6)] [!code-vb[Formatting.Numeric.Standard#6](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#6)] [Back to table](#table) @@ -264,7 +268,7 @@ When used with a value, the "G9" format specifier ensures t The following example formats floating-point values with the percent format specifier. [!code-cpp[Formatting.Numeric.Standard#7](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#7)] - [!code-csharp[Formatting.Numeric.Standard#7](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#7)] + [!code-csharp-interactive[Formatting.Numeric.Standard#7](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#7)] [!code-vb[Formatting.Numeric.Standard#7](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#7)] [Back to table](#table) @@ -273,7 +277,7 @@ When used with a value, the "G9" format specifier ensures t ## The Round-trip ("R") Format Specifier The round-trip ("R") format specifier attempts to ensure that a numeric value that is converted to a string is parsed back into the same numeric value. This format is supported only for the , , and types. -For and values, the "R" format specifier in some cases fails to successfully round-trip the original value and also offers relatively poor performance. Instead, we recommend that you use the ["G17"](#GFormatString) format specifier for values and the ["G9"](#GFormatString) format specifier to successfully round-trip values. +For values, the "R" format specifier in some cases fails to successfully round-trip the original value. For both and values, it also offers relatively poor performance. Instead, we recommend that you use the ["G17"](#GFormatString) format specifier for values and the ["G9"](#GFormatString) format specifier to successfully round-trip values. When a value is formatted using this specifier, its string representation contains all the significant digits in the value. @@ -289,7 +293,7 @@ For and values, the "R" format specifi The following example formats a value with the round-trip format specifier. [!code-cpp[R format specifier with a BigInteger](../../../samples/snippets/standard/base-types/format-strings/biginteger-r.cpp)] - [!code-csharp[R format specifier with a BigInteger](../../../samples/snippets/standard/base-types/format-strings/biginteger-r.cs)] + [!code-csharp-interactive[R format specifier with a BigInteger](../../../samples/snippets/standard/base-types/format-strings/biginteger-r.cs)] [!code-vb[R format specifier with a BigInteger](../../../samples/snippets/standard/base-types/format-strings/biginteger-r.vb)] > [!IMPORTANT] @@ -297,7 +301,7 @@ For and values, the "R" format specifi To work around the problem of values formatted with the "R" standard numeric format string not successfully round-tripping if compiled using the `/platform:x64` or `/platform:anycpu` switches and run on 64-bit systems., you can format values by using the "G17" standard numeric format string. The following example uses the "R" format string with a value that does not round-trip successfully, and also uses the "G17" format string to successfully round-trip the original value. - [!code-csharp[System.Double.ToString#5](../../../samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/roundtripex1.cs#5)] + [!code-csharp-interactive[System.Double.ToString#5](../../../samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/roundtripex1.cs#5)] [!code-vb[System.Double.ToString#5](../../../samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Double.ToString/vb/roundtripex1.vb#5)] [Back to table](#table) @@ -313,7 +317,7 @@ For and values, the "R" format specifi The following example formats values with the hexadecimal format specifier. [!code-cpp[Formatting.Numeric.Standard#9](../../../samples/snippets/cpp/VS_Snippets_CLR/Formatting.Numeric.Standard/cpp/Standard.cpp#9)] - [!code-csharp[Formatting.Numeric.Standard#9](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#9)] + [!code-csharp-interactive[Formatting.Numeric.Standard#9](../../../samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs#9)] [!code-vb[Formatting.Numeric.Standard#9](../../../samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.Numeric.Standard/vb/Standard.vb#9)] [Back to table](#table) @@ -338,11 +342,13 @@ For and values, the "R" format specifi ### Floating-Point Infinities and NaN Regardless of the format string, if the value of a or floating-point type is positive infinity, negative infinity, or not a number (NaN), the formatted string is the value of the respective , , or property that is specified by the currently applicable object. - ## Example + +[!INCLUDE[interactive-note](~/includes/csharp-interactive-with-culture-note.md)] + The following example formats an integral and a floating-point numeric value using the en-US culture and all the standard numeric format specifiers. This example uses two particular numeric types ( and ), but would yield similar results for any of the other numeric base types (, , , , , , , , , , and ). - [!code-csharp[system.x.tostring-and-culture#1](../../../samples/snippets/csharp/VS_Snippets_CLR_System/system.X.ToString-and-Culture/cs/xts.cs#1)] + [!code-csharp-interactive[system.x.tostring-and-culture#1](../../../samples/snippets/csharp/VS_Snippets_CLR_System/system.X.ToString-and-Culture/cs/xts.cs#1)] [!code-vb[system.x.tostring-and-culture#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR_System/system.X.ToString-and-Culture/vb/xts.vb#1)] ## See Also diff --git a/includes/csharp-interactive-with-culture-note.md b/includes/csharp-interactive-with-culture-note.md new file mode 100644 index 0000000000000..bf7c7303737ca --- /dev/null +++ b/includes/csharp-interactive-with-culture-note.md @@ -0,0 +1,6 @@ + +> [!NOTE] +> The C# examples in this article run in the [Try.NET](https://try.dot.net) inline code runner and playground. Select the **Run** button to run an example in an interactive window. Once you execute the code, you can modify it and run the modified code by selecting **Run** again. The modified code either runs in the interactive window or, if compilation fails, the interactive window displays all C# compiler error messages. +> +> The [current culture](xref:System.Globalization.CultureInfo.CurrentCulture) of the [Try.NET](https://try.dot.net) inline code runner and playground is the [invariant culture](xref:System.Globalization.CultureInfo.InvariantCulture). As a result, the output produced by the inline code runner differs from the output displayed by examples that use a default culture as the current culture. + From 66b7622f586223bafa8c9bdee284e94ca8c1b4f2 Mon Sep 17 00:00:00 2001 From: Petr Onderka Date: Mon, 11 Jun 2018 18:51:26 +0200 Subject: [PATCH 03/10] Updated microservice tutorial (#5878) --- docs/csharp/tutorials/microservices.md | 260 +++++++++++++------------ 1 file changed, 134 insertions(+), 126 deletions(-) diff --git a/docs/csharp/tutorials/microservices.md b/docs/csharp/tutorials/microservices.md index 13fdde519b14b..fba75bd23dbb2 100644 --- a/docs/csharp/tutorials/microservices.md +++ b/docs/csharp/tutorials/microservices.md @@ -1,7 +1,7 @@ --- title: Microservices hosted in Docker - C# description: Learn to create asp.net core services that run in Docker containers -ms.date: 02/03/2017 +ms.date: 06/08/2017 ms.assetid: 87e93838-a363-4813-b859-7356023d98ed --- @@ -11,21 +11,21 @@ This tutorial details the tasks necessary to build and deploy an ASP.NET Core microservice in a Docker container. During the course of this tutorial, you'll learn: -* How to generate an ASP.NET Core application using Yeoman -* How to create a development Docker environment +* How to generate an ASP.NET Core application. +* How to create a development Docker environment. * How to build a Docker image based on an existing image. * How to deploy your service into a Docker container. Along the way, you'll also see some C# language features: * How to convert C# objects into JSON payloads. -* How to build immutable Data Transfer Objects -* How to process incoming HTTP Requests and generate the HTTP Response -* How to work with nullable value types +* How to build immutable Data Transfer Objects. +* How to process incoming HTTP Requests and generate the HTTP Response. +* How to work with nullable value types. You can [view or download the sample app](https://github.com/dotnet/samples/tree/master/csharp/getting-started/WeatherMicroservice) for this topic. For download instructions, see [Samples and Tutorials](../../samples-and-tutorials/index.md#viewing-and-downloading-samples). -### Why Docker? +## Why Docker? Docker makes it easy to create standard machine images to host your services in a data center, or the public cloud. Docker @@ -37,10 +37,11 @@ The additional tasks for a Docker installation will work for an ASP.NET Core application. ## Prerequisites -You’ll need to setup your machine to run .NET core. You can find the + +You’ll need to setup your machine to run .NET Core. You can find the installation instructions on the [.NET Core](https://www.microsoft.com/net/core) page. -You can run this application on Windows, Ubuntu Linux, macOS or in a Docker container. +You can run this application on Windows, Linux, macOS or in a Docker container. You’ll need to install your favorite code editor. The descriptions below use [Visual Studio Code](https://code.visualstudio.com/) which is an open source, cross platform editor. However, you can use whatever tools you are @@ -52,89 +53,58 @@ for instructions for your platform. Docker can be installed in many Linux distributions, macOS, or Windows. The page referenced above contains sections to each of the available installations. -Most components to be installed are done by a package manager. If you have node.js's package manager `npm` installed you can skip this step. -Otherwise install the latest NodeJs from [nodejs.org](https://nodejs.org) which will install the npm package manager. - -At this point you will need to install a number of command line tools that support -ASP.NET core development. The command line templates use Yeoman, Bower, -Grunt, and Gulp. If you have them installed that is good, otherwise type the following into your favorite shell: - -`npm install -g yo bower grunt-cli gulp` - -The `-g` option indicates that it is a global install, and those tools are -available system wide. (A local install scopes the package to a single -project). Once you've installed those core tools, you need to install -the yeoman ASP.NET template generators: - -`npm install -g generator-aspnet` - ## Create the Application Now that you've installed all the tools, create a new ASP.NET Core -application. To use the command line generator, execute the following -yeoman command in your favorite shell: +application. To do that, create a new directory called "WeatherMicroservice" +and execute the following command in that directory in your favorite shell: -`yo aspnet` +```console +dotnet new web +``` + +The `dotnet` command runs the tools necessary +for .NET development. Each verb executes a different command. + +The `dotnet new` command is used to create .Net Core projects. -This command prompts you to select what Type of application you want to -create. For this microservice, you want the simplest, most lightweight -web application possible, so select 'Empty Web Application'. The template -will prompt you for a name. Select 'WeatherMicroservice'. +For this microservice, we want the simplest, most lightweight +web application possible, so we used the "ASP.NET Core Empty" template, +by specifying its short name, `web`. -The template creates eight files for you: +The template creates four files for you: -* A .gitignore, customized for ASP.NET Core applications. * A Startup.cs file. This contains the basis of the application. * A Program.cs file. This contains the entry point of the application. * A WeatherMicroservice.csproj file. This is the build file for the application. -* A Dockerfile. This script creates a Docker image for the application. -* A README.md. This contains links to other ASP.NET Core resources. -* A web.config file. This contains basic configuration information. -* A runtimeconfig.template.json file. This contains debugging settings used by IDEs. +* A Properties/launchSettings.json file. This contains debugging settings used by IDEs. -Now you can run the template generated application. That's done using a series -of tools from the command line. The `dotnet` command runs the tools necessary -for .NET development. Each verb executes a different command - -The first step is to restore all the dependencies: - -```console -dotnet restore -``` - -Dotnet restore uses the NuGet package manager to install all the necessary packages -into the application directory. It also generates a project.json.lock file. This -file contains information about each package that is referenced. After restoring -all the dependencies, you build the application: - -```console -dotnet build -``` -[!INCLUDE[DotNet Restore Note](~/includes/dotnet-restore-note.md)] - -And once you build the application, you run it from the command line: +Now you can run the template generated application: ```console dotnet run ``` +This command will first restore dependencies required to build the application +and then it will build the application. + The default configuration listens to `http://localhost:5000`. You can open a browser and navigate to that page and see a "Hello World!" message. +When you're done, you can shut down the application by pressing Ctrl+C. + ### Anatomy of an ASP.NET Core application Now that you've built the application, let's look at how this functionality is implemented. There are two of the generated files that are particularly -interesting at this point: project.json and Startup.cs. +interesting at this point: WeatherMicroservice.csproj and Startup.cs. + +The .csproj file contains information about the project. +The two nodes that are most interesting are `` and ``. -Project.json contains information about the project. The two nodes you'll -often work with are 'dependencies' and 'frameworks'. The -dependencies node lists all the packages that are needed for this application. -At the moment, this is a small node, needing only the packages that run the -web server. +The `` node specifies the version of .NET that will run this application. -The 'frameworks' node specifies the versions and configurations of the .NET -framework that will run this application. +Each `` node is used to specify a package that is needed for this application. The application is implemented in Startup.cs. This file contains the startup class. @@ -164,12 +134,14 @@ our random weather service: The next sections walk you through each of these steps. -### Parsing the Query String. +### Parsing the Query String You'll begin by parsing the query string. The service will accept 'lat' and 'long' arguments on the query string in this form: -`http://localhost:5000/?lat=-35.55&long=-12.35` +``` +http://localhost:5000/?lat=-35.55&long=-12.35 +``` All the changes you need to make are in the lambda expression defined as the argument to `app.Run` in your startup class. @@ -182,7 +154,7 @@ find the latitude and longitude values: [!code-csharp[ReadQueryString](../../../samples/csharp/getting-started/WeatherMicroservice/Startup.cs#ReadQueryString "read variables from the query string")] -The Query dictionary values are `StringValue` type. That type can +The `Query` dictionary values are `StringValue` type. That type can contain a collection of strings. For your weather service, each value is a single string. That's why there's the call to `FirstOrDefault()` in the code above. @@ -213,10 +185,13 @@ the extension method for parse: [!code-csharp[TryParseExtension](../../../samples/csharp/getting-started/WeatherMicroservice/Extensions.cs#TryParseExtension "try parse to a nullable")] -The `default(double?)` expression returns the default value for the -`double?` type. That default value is the null (or missing) value. +Before calling the extension method, change the current culture to invariant: + +[!code-csharp[SetCulture](../../../samples/csharp/getting-started/WeatherMicroservice/Startup.cs#SetCulture "set current culture to invariant")] -You can use this extension method to convert the query string arguments +This ensures that your application parses numbers the same on any server, regardless of its default culture. + +Now you can use the extension method to convert the query string arguments into the double type: [!code-csharp[UseTryParse](../../../samples/csharp/getting-started/WeatherMicroservice/Startup.cs#UseTryParse "Use the try parse extension method")] @@ -238,7 +213,7 @@ container that holds the values you'd want for a weather forecast: ```csharp public class WeatherReport { - private static readonly string[] PossibleConditions = new string[] + private static readonly string[] PossibleConditions = { "Sunny", "Mostly Sunny", @@ -248,33 +223,42 @@ public class WeatherReport "Rain" }; - public int HiTemperature { get; } - public int LoTemperature { get; } - public int AverageWindSpeed { get; } - public string Conditions { get; } + public int HighTemperatureFahrenheit { get; } + public int LowTemperatureFahrenheit { get; } + public int AverageWindSpeedMph { get; } + public string Condition { get; } } ``` Next, build a constructor that randomly sets those values. This constructor uses -the values for the latitude and longitude to seed the Random number generator. That +the values for the latitude and longitude to seed the `Random` number generator. That means the forecast for the same location is the same. If you change the arguments for the latitude and longitude, you'll get a different forecast (because you start with a -different seed.) +different seed). [!code-csharp[WeatherReportConstructor](../../../samples/csharp/getting-started/WeatherMicroservice/WeatherReport.cs#WeatherReportConstructor "Weather Report Constructor")] You can now generate the 5-day forecast in your response method: -[!code-csharp[GenerateRandomReport](../../../samples/csharp/getting-started/WeatherMicroservice/Startup.cs#GenerateRandomReport "Generate a random weather report")] +```csharp +if (latitude.HasValue && longitude.HasValue) +{ + var forecast = new List(); + for (var days = 1; days <= 5; days++) + { + forecast.Add(new WeatherReport(latitude.Value, longitude.Value, days)); + } +} +``` -### Build the JSON response. +### Build the JSON response -The final code task on the server is to convert the WeatherReport array -into a JSON packet, and send that back to the client. Let's start by creating -the JSON packet. You'll add the NewtonSoft JSON Serializer to the -list of dependencies. You can do that using the `dotnet` CLI: +The final code task on the server is to convert the `WeatherReport` list +into JSON document, and send that back to the client. Let's start by creating +the JSON document. You'll add the Newtonsoft JSON serializer to the +list of dependencies. You can do that using the following `dotnet` command: -``` +```console dotnet add package Newtonsoft.Json ``` @@ -283,7 +267,7 @@ Then, you can use the `JsonConvert` class to write the object to a string: [!code-csharp[ConvertToJson](../../../samples/csharp/getting-started/WeatherMicroservice/Startup.cs#ConvertToJSON "Convert objects to JSON")] The code above converts the forecast object (a list of `WeatherForecast` -objects) into a JSON packet. After you've constructed the response packet, +objects) into a JSON document. After you've constructed the response document, you set the content type to `application/json`, and write the string. The application now runs and returns random forecasts. @@ -295,18 +279,38 @@ Docker container that runs a Docker image that represents our application. A ***Docker Image*** is a file that defines the environment for running the application. -A ***Docker Container*** represents a running instance of a Docker image. +A ***Docker Container*** represents a running instance of a Docker Image. By analogy, you can think of the *Docker Image* as a *class*, and the *Docker Container* as an object, or an instance of that class. -The Dockerfile created by the ASP.NET template will serve -for our purposes. Let's go over its contents. +The following Dockerfile will serve for our purposes: + +``` +FROM microsoft/dotnet:2.1-sdk AS build +WORKDIR /app + +# Copy csproj and restore as distinct layers +COPY *.csproj ./ +RUN dotnet restore -The first line specifies the source image: +# Copy everything else and build +COPY . ./ +RUN dotnet publish -c Release -o out + +# Build runtime image +FROM microsoft/dotnet:2.1-aspnetcore-runtime +WORKDIR /app +COPY --from=build /app/out . +ENTRYPOINT ["dotnet", "WeatherMicroservice.dll"] +``` + +Let's go over its contents. + +The first line specifies the source image used for building the application: ``` -FROM microsoft/dotnet:1.1-sdk-msbuild +FROM microsoft/dotnet:2.1-sdk AS build ``` Docker allows you to configure a machine image based on a @@ -315,47 +319,51 @@ the machine parameters when you start, you only need to supply any changes. The changes here will be to include our application. -In this first sample, we'll use the `1.1-sdk-msbuild` version of -the dotnet image. This is the easiest way to create a working Docker -environment. This image include the dotnet core runtime, and the dotnet SDK. -That makes it easier to get started and build, but does create a larger image. +In this sample, we'll use the `2.1-sdk` version of +the `dotnet` image. This is the easiest way to create a working Docker +environment. This image includes the .NET Core runtime, and the .NET Core SDK. +That makes it easier to get started and build, but does create a larger image, +so we'll use this image for building the application and a different image to run it. -The next five lines setup and build your application: +The next lines setup and build your application: ``` WORKDIR /app -# copy csproj and restore as distinct layers - -COPY WeatherMicroService.csproj . -RUN dotnet restore +# Copy csproj and restore as distinct layers +COPY *.csproj ./ +RUN dotnet restore -# copy and build everything else - -COPY . . - -# RUN dotnet restore +# Copy everything else and build +COPY . ./ RUN dotnet publish -c Release -o out ``` -[!INCLUDE[DotNet Restore Note](~/includes/dotnet-restore-note.md)] - This will copy the project file from the current directory to the Docker VM, and restore all the packages. Using the dotnet CLI means that the Docker image must include the -.NET Core SDK. After that, the rest of your application gets copied, and the dotnet -publish command builds and packages your application. +.NET Core SDK. After that, the rest of your application gets copied, and the `dotnet +publish` command builds and packages your application. -The final line of the file runs the application: +Finally, we create a second Docker image that runs the application: ``` -ENTRYPOINT ["dotnet", "out/WeatherMicroService.dll", "--server.urls", "http://0.0.0.0:5000"] +# Build runtime image +FROM microsoft/dotnet:2.1-aspnetcore-runtime +WORKDIR /app +COPY --from=build /app/out . +ENTRYPOINT ["dotnet", "WeatherMicroservice.dll"] ``` -This configured port is referenced in the `--server.urls` -argument to `dotnet` on the last line of the Dockerfile. The `ENTRYPOINT` command -informs Docker what command and command-line options start the service. +This image uses the `2.1-aspnetcore-runtime` version of the `dotnet` image, +which contains everything necessary to run ASP.NET Core applications, +but does not include the .NET Core SDK. This means this image can't be used to build +.NET Core applications, but it also makes the final image smaller. + +To make this work, we copy the built application from the first image to the second one. + +The `ENTRYPOINT` command informs Docker what command starts the service. -## Building and running the image in a container. +## Building and running the image in a container Let's build an image and run the service inside a Docker container. You don't want all the files from your local directory copied into the image. Instead, you'll @@ -386,16 +394,16 @@ Run the following command to start the container and launch your service: ```console -docker run -d -p 80:5000 --name hello-docker weather-microservice +docker run -d -p 80:80 --name hello-docker weather-microservice ``` The `-d` option means to run the container detached from the current terminal. That means you won't see the command output in your terminal. The `-p` option indicates the port mapping between the service and the host. Here it says that any incoming request on port 80 should be forwarded -to port 5000 on the container. Using 5000 matches the port your service is listening on from -the command line arguments specified in the Dockerfile above. The `--name` argument +to port 80 on the container. Using 80 matches the port your service is listening on, +which is the default port for production applications. The `--name` argument names your running container. It's a convenient name you can use to work with that -container. +container. You can see if the image is running by checking the command: @@ -404,7 +412,7 @@ docker ps ``` If your container is running, you'll see a line that lists -it in the running processes. (It may be the only one). +it in the running processes. (It may be the only one.) You can test your service by opening a browser and navigating to localhost, and specifying a latitude and longitude: @@ -415,7 +423,7 @@ http://localhost/?lat=35.5&long=40.75 ## Attaching to a running container -When you ran your sevice in a command window, you could see diagnostic information printed +When you ran your service in a command window, you could see diagnostic information printed for each request. You don't see that information when your container is running in detached mode. The Docker attach command enables you to attach to a running container so that you can see the log information. Run this command from a command window: @@ -424,18 +432,18 @@ can see the log information. Run this command from a command window: docker attach --sig-proxy=false hello-docker ``` -The `--sig-proxy=false` argument means that `Ctrl-C` commands do not get sent to the +The `--sig-proxy=false` argument means that Ctrl+C commands do not get sent to the container process, but rather stop the `docker attach` command. The final argument is the name given to the container in the `docker run` command. > [!NOTE] > You can also use the Docker assigned container ID to refer to any container. If you -> didn't specify a name for your container in `docker run` you must use the container id. +> didn't specify a name for your container in `docker run` you must use the container ID. Open a browser and navigate to your service. You'll see the diagnostic messages in the command windows from the attached running container. -Press `Ctrl-C` to stop the attach process. +Press Ctrl+C to stop the attach process. When you are done working with your container, you can stop it: From 2dce3b24c3218fc95e8491075a2172806702bbe0 Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Mon, 11 Jun 2018 10:19:52 -0700 Subject: [PATCH 04/10] add link to docs contributor guide (#5881) * add link to docs contributor guide * Update CONTRIBUTING.md --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5d8353168b35..69ff73a1d4a35 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,9 @@ Thank you for your interest in contributing to the .NET documentation! +> We're in the process of moving our guidelines into a site-wide contribution guide. +> To see the new guidance, visit [Microsoft Docs contributor guide overview](https://docs.microsoft.com/contribute/). + The document covers the process for contributing to the articles and code samples that are hosted on the [.NET documentation site](https://docs.microsoft.com/dotnet). Contributions may be as simple as typo corrections or as complex as new articles. * [Process for contributing](#process-for-contributing) From beca1d62f2c5645f9f03030f4ed1abb0379d929b Mon Sep 17 00:00:00 2001 From: Opportunity Date: Tue, 12 Jun 2018 02:07:18 +0800 Subject: [PATCH 05/10] Fix special character in markdown table (#5902) * Update custom-date-and-time-format-strings.md * Update custom-timespan-format-strings.md --- docs/standard/base-types/custom-date-and-time-format-strings.md | 2 +- docs/standard/base-types/custom-timespan-format-strings.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/standard/base-types/custom-date-and-time-format-strings.md b/docs/standard/base-types/custom-date-and-time-format-strings.md index 54117cd93d26b..11f51b05b5071 100644 --- a/docs/standard/base-types/custom-date-and-time-format-strings.md +++ b/docs/standard/base-types/custom-date-and-time-format-strings.md @@ -85,7 +85,7 @@ A date and time format string defines the text representation of a
More Information: [The "/" Custom Format Specifier](#dateSeparator).|2009-06-15T13:45:30 -> / (en-US)

2009-06-15T13:45:30 -> - (ar-DZ)

2009-06-15T13:45:30 -> . (tr-TR)| |"*string*"

'*string*'|Literal string delimiter.

More information: [Character literals](#Literals).|2009-06-15T13:45:30 ("arr:" h:m t) -> arr: 1:45 P

2009-06-15T13:45:30 ('arr:' h:m t) -> arr: 1:45 P| |%|Defines the following character as a custom format specifier.

More information:[Using Single Custom Format Specifiers](#UsingSingleSpecifiers).|2009-06-15T13:45:30 (%h) -> 1| -|\|The escape character.

More information: [Character literals](#Literals) and [Using the Escape Character](#escape).|2009-06-15T13:45:30 (h \h) -> 1 h| +|\\|The escape character.

More information: [Character literals](#Literals) and [Using the Escape Character](#escape).|2009-06-15T13:45:30 (h \h) -> 1 h| |Any other character|The character is copied to the result string unchanged.

More information: [Character literals](#Literals).|2009-06-15T01:45:30 (arr hh:mm t) -> arr 01:45 A| The following sections provide additional information about each custom date and time format specifier. Unless otherwise noted, each specifier produces an identical string representation regardless of whether it is used with a value or a value. diff --git a/docs/standard/base-types/custom-timespan-format-strings.md b/docs/standard/base-types/custom-timespan-format-strings.md index 24e470a79675c..1bc06f06fdd16 100644 --- a/docs/standard/base-types/custom-timespan-format-strings.md +++ b/docs/standard/base-types/custom-timespan-format-strings.md @@ -61,7 +61,7 @@ A format string defines the string representation of a
More information: [The "FFFFFF" Custom Format Specifier](#F6_Specifier).|`TimeSpan.Parse("00:00:06.3291791")`:

`FFFFFF`: 329179

`TimeSpan.Parse("0:0:3.1000009")`:

`ss\.FFFFFF`: 03.1| |"FFFFFFF"|The ten-millions of a second in a time interval. Any fractional trailing zeros or seven zeros are not displayed.

More information: [The "FFFFFFF" Custom Format Specifier](#F7_Specifier).|`TimeSpan.Parse("00:00:06.3291791")`:

`FFFFFF`: 3291791

`TimeSpan.Parse("0:0:3.1900000")`:

`ss\.FFFFFF`: 03.19| |*'string*'|Literal string delimiter.

More information: [Other Characters](#Other).|`new TimeSpan(14, 32, 17):`

`hh':'mm':'ss` --> "14:32:17"| -|\|The escape character.

More information:[Other Characters](#Other).|`new TimeSpan(14, 32, 17):`

`hh\:mm\:ss` --> "14:32:17"| +|\\|The escape character.

More information:[Other Characters](#Other).|`new TimeSpan(14, 32, 17):`

`hh\:mm\:ss` --> "14:32:17"| |Any other character|Any other unescaped character is interpreted as a custom format specifier.

More Information: [Other Characters](#Other).|`new TimeSpan(14, 32, 17):`

`hh\:mm\:ss` --> "14:32:17"| From 09f368fc7c0d14a48e46c6c11ace5b49c8917bd1 Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Tue, 12 Jun 2018 00:04:58 -0700 Subject: [PATCH 06/10] remove msdn links (#5867) * remove msdn links * Fix new line * feedback * Update globalizing-windows-forms.md * update incoming links --- ...-support-for-windows-forms-applications.md | 7 +- ...an-characters-with-the-imemode-property.md | 5 +- ...ncoding-and-windows-forms-globalization.md | 5 +- .../advanced/globalizing-windows-forms.md | 88 +++++++++---------- docs/framework/winforms/advanced/index.md | 2 +- ...nal-fonts-in-windows-forms-and-controls.md | 7 +- 6 files changed, 55 insertions(+), 59 deletions(-) diff --git a/docs/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md b/docs/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md index c1553941000da..dc4bcc764c362 100644 --- a/docs/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md +++ b/docs/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md @@ -111,6 +111,7 @@ You can use Visual Studio to create Windows-based applications that support bi-d Some controls are sealed. Therefore, you cannot derive a new control from them. These include the and controls. -## See Also - [Bidirectional Support for ASP.NET Web Applications](http://msdn.microsoft.com/library/5576f9b1-9b86-41ef-8354-092d366bcd03) - [Globalizing Windows Forms](../../../../docs/framework/winforms/advanced/globalizing-windows-forms.md) +## See also + +[Bidirectional Support for ASP.NET Web Applications](http://msdn.microsoft.com/library/5576f9b1-9b86-41ef-8354-092d366bcd03) +[Globalizing Windows Forms applications](globalizing-windows-forms.md) diff --git a/docs/framework/winforms/advanced/display-of-asian-characters-with-the-imemode-property.md b/docs/framework/winforms/advanced/display-of-asian-characters-with-the-imemode-property.md index 0366a9e3fd384..b75da4aef0d6a 100644 --- a/docs/framework/winforms/advanced/display-of-asian-characters-with-the-imemode-property.md +++ b/docs/framework/winforms/advanced/display-of-asian-characters-with-the-imemode-property.md @@ -19,5 +19,6 @@ ms.assetid: c60ae399-0dab-4f07-9dea-6dbfb15ec0ae The property is used by forms and controls to force a specific mode for an input method editor (IME). The IME is an essential component for writing Chinese, Japanese, and Korean scripts, since these writing systems have more characters than can be encoded for a regular keyboard. For example, you may want to allow only ASCII characters in a particular text box. In such a case you can set the property to and users will only be able to enter ASCII characters for that particular text box. The default value of the property is , so if you set the property for a form, all controls on the form will inherit that setting. For more information, see ) and . -## See Also - [Globalizing Windows Forms](../../../../docs/framework/winforms/advanced/globalizing-windows-forms.md) +## See also + +[Globalizing Windows Forms applications](globalizing-windows-forms.md) diff --git a/docs/framework/winforms/advanced/encoding-and-windows-forms-globalization.md b/docs/framework/winforms/advanced/encoding-and-windows-forms-globalization.md index f6711e66d47ea..933fa0ea5e23b 100644 --- a/docs/framework/winforms/advanced/encoding-and-windows-forms-globalization.md +++ b/docs/framework/winforms/advanced/encoding-and-windows-forms-globalization.md @@ -30,5 +30,6 @@ Windows Forms applications are entirely Unicode-enabled, meaning that each chara For Unicode-aware alternatives to the and controls, use the and controls, which replace these older controls. To maintain a similar look and feel between visual elements in your application, use the control for rendering menus instead of . Like and , can also process and display Unicode characters. -## See Also - [Globalizing Windows Forms](../../../../docs/framework/winforms/advanced/globalizing-windows-forms.md) +## See also + +[Globalizing Windows Forms applications](globalizing-windows-forms.md) diff --git a/docs/framework/winforms/advanced/globalizing-windows-forms.md b/docs/framework/winforms/advanced/globalizing-windows-forms.md index ae65505c05f90..69d7e9269d6c8 100644 --- a/docs/framework/winforms/advanced/globalizing-windows-forms.md +++ b/docs/framework/winforms/advanced/globalizing-windows-forms.md @@ -1,6 +1,7 @@ --- -title: "Globalizing Windows Forms" -ms.date: "03/30/2017" +title: "Globalizing Windows Forms applications" +description: This topic presents a list of topics related to globalizing Windows Forms applications. +ms.date: "06/08/2018" helpviewer_keywords: - "Windows Forms, globalization" - "localization [Windows Forms]" @@ -9,49 +10,40 @@ helpviewer_keywords: - "global applications [Windows Forms], creating Windows Forms" ms.assetid: 72f6cd92-83be-45ec-aa37-9cb8e3ebc3c5 --- -# Globalizing Windows Forms -*Globalization* is the process of designing and developing a software product that functions for multiple cultures. - -## In This Section - [Encoding and Windows Forms Globalization](../../../../docs/framework/winforms/advanced/encoding-and-windows-forms-globalization.md) - Describes full Unicode support and its implications. - - [International Fonts in Windows Forms and Controls](../../../../docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md) - Explains when and how to select fonts for display of international characters on Windows Forms. - - [Display of Asian Characters with the ImeMode Property](../../../../docs/framework/winforms/advanced/display-of-asian-characters-with-the-imemode-property.md) - Introduces the `ImeMode` property, which is used to control the type of input a Windows Form or control accepts. - -- [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API Using the Designer](http://msdn.microsoft.com/library/ms366788\(v=vs.110\)) - -- [Localizing ClickOnce Applications](http://msdn.microsoft.com/library/ms404266\(v=vs.110\)) - -- [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API](http://msdn.microsoft.com/library/ms404269\(v=vs.110\)) - -- [How to: Set the Culture and UI Culture for Windows Forms Globalization](http://msdn.microsoft.com/library/b28bx3bh\(v=vs.110\)) - -- [How to: Create Mirrored Windows Forms and Controls](http://msdn.microsoft.com/library/xwbz5ws0\(v=vs.110\)) - -- [How to: Support Localization on Windows Forms Using AutoSize and the TableLayoutPanel Control](http://msdn.microsoft.com/library/1zkt8b33\(v=vs.110\)) - -- [Walkthrough: Localizing Windows Forms](http://msdn.microsoft.com/library/y99d1cd3\(v=vs.110\)) - -- [Walkthrough: Creating a Layout That Adjusts Proportion for Localization](http://msdn.microsoft.com/library/7k9fa71y\(v=vs.110\)) - -- [How to: Create Message Boxes for Bi-Directional Windows Forms](http://msdn.microsoft.com/library/k1689bxh\(v=vs.110\)) - -- [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API Using the Designer](http://msdn.microsoft.com/library/ms366788\(v=vs.120\)) - -- [Localizing ClickOnce Applications](http://msdn.microsoft.com/library/ms404266\(v=vs.120\)) - -- [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API](http://msdn.microsoft.com/library/ms404269\(v=vs.120\)) - -## Related Sections - -1. [Globalizing and Localizing Applications](http://msdn.microsoft.com/library/1021kkz0\(v=vs.110\)) - -2. [Globalizing Applications](http://msdn.microsoft.com/library/eaa7b9c0\(v=vs.110\)) - -3. [Globalizing and Localizing Applications](http://msdn.microsoft.com/library/1021kkz0\(v=vs.120\)) - -4. [Globalizing Applications](http://msdn.microsoft.com/library/eaa7b9c0\(v=vs.120\)) +# Globalizing Windows Forms applications + +*Globalization* is the process of designing and developing a software product that functions for multiple cultures. + +## In this section + +[Encoding and Windows Forms Globalization](encoding-and-windows-forms-globalization.md) +Describes full Unicode support and its implications. + +[International Fonts in Windows Forms and Controls](international-fonts-in-windows-forms-and-controls.md) +Explains when and how to select fonts for display of international characters on Windows Forms. + +[Bi-Directional Support for Windows Forms Applications](bi-directional-support-for-windows-forms-applications.md) +Explains how to create Windows-based applications that support bi-directional (right-to-left) languages. + +[Display of Asian Characters with the ImeMode Property](display-of-asian-characters-with-the-imemode-property.md) +Introduces the `ImeMode` property, which is used to control the type of input a Windows Form or control accepts. + +## Related sections + +- [Globalizing and localizing .NET applications](../../../standard/globalization-localization/index.md) + +- [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API Using the Designer](/visualstudio/deployment/walkthrough-downloading-satellite-assemblies-on-demand-with-the-clickonce-deployment-api-using-the-designer) + +- [Localizing ClickOnce Applications](/visualstudio/deployment/localizing-clickonce-applications) + +- [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API](/visualstudio/deployment/walkthrough-downloading-satellite-assemblies-on-demand-with-the-clickonce-deployment-api) + +- [How to: Set the Culture and UI Culture for Windows Forms Globalization](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/b28bx3bh(v=vs.100)) + +- [How to: Create Mirrored Windows Forms and Controls](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/xwbz5ws0(v=vs.100)) + +- [How to: Support Localization on Windows Forms Using AutoSize and the TableLayoutPanel Control](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/1zkt8b33(v=vs.100)) + +- [Walkthrough: Localizing Windows Forms](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/y99d1cd3(v=vs.100)) + +- [Walkthrough: Creating a Layout That Adjusts Proportion for Localization](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)) diff --git a/docs/framework/winforms/advanced/index.md b/docs/framework/winforms/advanced/index.md index 88eaf6d9b9d20..57f0631a432dc 100644 --- a/docs/framework/winforms/advanced/index.md +++ b/docs/framework/winforms/advanced/index.md @@ -25,7 +25,7 @@ Windows Forms contains many features that you can use to enhance your Windows-ba [Networking in Windows Forms Applications](../../../../docs/framework/winforms/advanced/networking-in-windows-forms-applications.md) Contains links to topics that describe and show how to use networking in Windows Forms. - [Globalizing Windows Forms](../../../../docs/framework/winforms/advanced/globalizing-windows-forms.md) + [Globalizing Windows Forms applications](../../../../docs/framework/winforms/advanced/globalizing-windows-forms.md) Contains links to topics that show how to globalize Windows Forms applications. [Windows Forms and Unmanaged Applications](../../../../docs/framework/winforms/advanced/windows-forms-and-unmanaged-applications.md) diff --git a/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md b/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md index f4f16da0f819b..36349c64c57d6 100644 --- a/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md +++ b/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md @@ -73,6 +73,7 @@ TextBox1.Font = New System.Drawing.Font(Me.Font, TextBox1.Font.Style) textBox1.Font = new System.Drawing.Font(this.Font, textBox1.Font.Style); ``` -## See Also - [Globalizing Windows Forms](../../../../docs/framework/winforms/advanced/globalizing-windows-forms.md) - [Using Fonts and Text](../../../../docs/framework/winforms/advanced/using-fonts-and-text.md) +## See also + +[Globalizing Windows Forms applications](globalizing-windows-forms.md) +[Using Fonts and Text](using-fonts-and-text.md) From f01d5f119dd57819b18e09efd34f2fd9b756d55a Mon Sep 17 00:00:00 2001 From: Avinash Barnwal Date: Tue, 12 Jun 2018 12:40:26 +0530 Subject: [PATCH 07/10] Update tuples.md (#5858) Fix Lifted Conversions Link --- docs/csharp/tuples.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/csharp/tuples.md b/docs/csharp/tuples.md index f7dfe862b876b..24aa65ec5ac8c 100644 --- a/docs/csharp/tuples.md +++ b/docs/csharp/tuples.md @@ -153,7 +153,8 @@ Beginning with C# 7.3, tuple types support the `==` and `!=` operators. These op [!code-csharp[TupleEquality](../../samples/snippets/csharp/tuples/tuples/program.cs#Equality "Testing tuples for equality")] -There are several rules that make tuple equality tests more convenient. Tuple equality performs [lifted conversions](/dotnet/csharp/language-reference/language-specification/conversions.md#lifted-conversion-operators) if one of the tuples is a nullable tuple, as shown in the following code: +There are several rules that make tuple equality tests more convenient. Tuple equality performs [lifted conversions](/dotnet/csharp/language-reference/language-specification/conversions#lifted-conversion-operators) if one of the tuples is a nullable tuple, as shown in the following code: + [!code-csharp[NullableTupleEquality](../../samples/snippets/csharp/tuples/tuples/program.cs#NullableEquality "Comparing Tuples and nullable tuples")] From 0ab16d7648f20389b3b13a4d19d47fbdc5420ad2 Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Tue, 12 Jun 2018 00:50:06 -0700 Subject: [PATCH 08/10] fixed code blocks (#5886) * fixed code blocks * feedback --- ...nal-fonts-in-windows-forms-and-controls.md | 131 +++++++++--------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md b/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md index 36349c64c57d6..5b91f96047cb8 100644 --- a/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md +++ b/docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md @@ -1,5 +1,5 @@ --- -title: "International Fonts in Windows Forms and Controls" +title: "International fonts in Windows Forms and controls" ms.date: "03/30/2017" helpviewer_keywords: - "fonts [Windows Forms], international" @@ -9,71 +9,76 @@ helpviewer_keywords: - "Windows Forms controls, labels" - "font fallback in Windows Forms" - "globalization [Windows Forms], character sets" +dev_langs: + - "csharp" + - "vb" ms.assetid: 2c3066df-9bac-479a-82b2-79e484b346a3 --- -# International Fonts in Windows Forms and Controls -In International applications the recommended method of selecting fonts is to use font fallback wherever possible. Font fallback means that the system determines what script the character belongs to. - -## Using Font Fallback - To take advantage of this feature, do not set the property for your form or any other element. The application will automatically use the default system font, which differs from one localized language of the operating system to another. When the application runs, the system will automatically provide the correct font for the culture selected in the operating system. - - There is an exception to the rule of not setting the font, which is for changing the font style. This might be important for an application in which the user clicks a button to make text in a text box appear in boldface. To do that, you would write a function to change the text box's font style to bold, based on whatever the form's font is. It is important to call this function in two places: in the button's event handler and in the event handler. If the function is called only in the event handler and some other piece of code changes the font family of the entire form, the text box will not change with the rest of the form. - -``` -' Visual Basic -Private Sub MakeBold() - ' Change the TextBox to a bold version of the form font - TextBox1.Font = New Font(Me.Font, FontStyle.Bold) -End Sub - -Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click - ' Clicking this button makes the TextBox bold - MakeBold() -End Sub - -Private Sub Form1_FontChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.FontChanged - ' If the TextBox is already bold and the form's font changes, - ' change the TextBox to a bold version of the new form font - If (TextBox1.Font.Style = FontStyle.Bold) Then - MakeBold() - End If -End Sub - -// C# -private void button1_Click(object sender, System.EventArgs e) -{ - // Clicking this button makes the TextBox bold - MakeBold(); -} - -private void MakeBold() -{ - // Change the TextBox to a bold version of the form's font - textBox1.Font = new Font(this.Font, FontStyle.Bold); -} - -private void Form1_FontChanged(object sender, System.EventArgs e) -{ - // If the TextBox is already bold and the form's font changes, - // change the TextBox to a bold version of the new form font - if (textBox1.Font.Style == FontStyle.Bold) - { - MakeBold(); - } -} -``` - - However, when you localize your application, the bold font may display poorly for certain languages. If this is a concern, you want the localizers to have the option of switching the font from bold to regular text. Since localizers are typically not developers and do not have access to source code, only to resource files, this option needs to be set in the resource files. To do this, you would set the property to `true`. This results in the font setting being written out to the resource files, where localizers can edit it. You then write code after the `InitializeComponent` method to reset the font based on whatever the form's font is, but using the font style specified in the resource file. - -``` -' Visual Basic -TextBox1.Font = New System.Drawing.Font(Me.Font, TextBox1.Font.Style) - -// C# -textBox1.Font = new System.Drawing.Font(this.Font, textBox1.Font.Style); -``` +# International fonts in Windows Forms and controls + +In International applications, the recommended method of selecting fonts is to use font fallback wherever possible. Font fallback means that the system determines what script the character belongs to. + +## Using font fallback + +To take advantage of this feature, don't set the property for your form or any other element. The application will automatically use the default system font, which differs from one localized language of the operating system to another. When the application runs, the system will automatically provide the correct font for the culture selected in the operating system. + +There's an exception to the rule of not setting the font, which is for changing the font style. This might be important for an application in which the user clicks a button to make text in a text box appear in boldface. To do that, you would write a function to change the text box's font style to bold, based on whatever the form's font is. It's important to call this function in two places: in the button's event handler and in the event handler. If the function is called only in the event handler and some other piece of code changes the font family of the entire form, the text box doesn't change with the rest of the form. + +```vb +Private Sub MakeBold() + ' Change the TextBox to a bold version of the form font + TextBox1.Font = New Font(Me.Font, FontStyle.Bold) +End Sub + +Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Clicking this button makes the TextBox bold + MakeBold() +End Sub + +Private Sub Form1_FontChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.FontChanged + ' If the TextBox is already bold and the form's font changes, + ' change the TextBox to a bold version of the new form font + If (TextBox1.Font.Style = FontStyle.Bold) Then + MakeBold() + End If +End Sub +``` + +```csharp +private void button1_Click(object sender, System.EventArgs e) +{ + // Clicking this button makes the TextBox bold + MakeBold(); +} + +private void MakeBold() +{ + // Change the TextBox to a bold version of the form's font + textBox1.Font = new Font(this.Font, FontStyle.Bold); +} + +private void Form1_FontChanged(object sender, System.EventArgs e) +{ + // If the TextBox is already bold and the form's font changes, + // change the TextBox to a bold version of the new form font + if (textBox1.Font.Style == FontStyle.Bold) + { + MakeBold(); + } +} +``` + +However, when you localize your application, the bold font may display poorly for certain languages. If this is a concern, you want the localizers to have the option of switching the font from bold to regular text. Since localizers are typically not developers and don't have access to source code, only to resource files, this option needs to be set in the resource files. To do this, you would set the property to `true`. This results in the font setting being written out to the resource files, where localizers can edit it. You then write code after the `InitializeComponent` method to reset the font based on whatever the form's font is, but using the font style specified in the resource file. + +```vb +TextBox1.Font = New System.Drawing.Font(Me.Font, TextBox1.Font.Style) +``` + +```csharp +textBox1.Font = new System.Drawing.Font(this.Font, textBox1.Font.Style); +``` ## See also [Globalizing Windows Forms applications](globalizing-windows-forms.md) -[Using Fonts and Text](using-fonts-and-text.md) +[Using Fonts and Text](using-fonts-and-text.md) \ No newline at end of file From 6cd2a0b0124ca20628b59bbd8dbb110c170b11e2 Mon Sep 17 00:00:00 2001 From: tsahi Date: Tue, 12 Jun 2018 18:12:21 +0300 Subject: [PATCH 09/10] Patch 1 (#5908) * Update how-to-implement-interface-events.md Use C# 6 null-propagation operator to check for event handlers. * Update how-to-implement-interface-events_1.cs Use C# 6 null-propagation operator; use `EventArgs.Empty` instead of `new EventArgs()`; no need for `new EventHandler()`, the compiler will do it for you. --- .../how-to-implement-interface-events_1.cs | 21 +++++++------------ .../how-to-implement-interface-events.md | 9 +++----- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/docs/csharp/programming-guide/events/codesnippet/CSharp/how-to-implement-interface-events_1.cs b/docs/csharp/programming-guide/events/codesnippet/CSharp/how-to-implement-interface-events_1.cs index 1931784e49246..d840dff02cc2b 100644 --- a/docs/csharp/programming-guide/events/codesnippet/CSharp/how-to-implement-interface-events_1.cs +++ b/docs/csharp/programming-guide/events/codesnippet/CSharp/how-to-implement-interface-events_1.cs @@ -74,19 +74,12 @@ event EventHandler IShape.OnDraw public void Draw() { // Raise IDrawingObject's event before the object is drawn. - EventHandler handler = PreDrawEvent; - if (handler != null) - { - handler(this, new EventArgs()); - } + PreDrawEvent?.Invoke(this, EventArgs.Empty); + Console.WriteLine("Drawing a shape."); - // RaiseIShape's event after the object is drawn. - handler = PostDrawEvent; - if (handler != null) - { - handler(this, new EventArgs()); - } + // Raise IShape's event after the object is drawn. + PostDrawEvent?.Invoke(this, EventArgs.Empty); } } public class Subscriber1 @@ -95,7 +88,7 @@ public class Subscriber1 public Subscriber1(Shape shape) { IDrawingObject d = (IDrawingObject)shape; - d.OnDraw += new EventHandler(d_OnDraw); + d.OnDraw += d_OnDraw; } void d_OnDraw(object sender, EventArgs e) @@ -109,7 +102,7 @@ public class Subscriber2 public Subscriber2(Shape shape) { IShape d = (IShape)shape; - d.OnDraw += new EventHandler(d_OnDraw); + d.OnDraw += d_OnDraw; } void d_OnDraw(object sender, EventArgs e) @@ -139,4 +132,4 @@ static void Main(string[] args) Sub1 receives the IDrawingObject event. Drawing a shape. Sub2 receives the IShape event. -*/ \ No newline at end of file +*/ diff --git a/docs/csharp/programming-guide/events/how-to-implement-interface-events.md b/docs/csharp/programming-guide/events/how-to-implement-interface-events.md index 292f479f9db8b..be3b95fdc2b9c 100644 --- a/docs/csharp/programming-guide/events/how-to-implement-interface-events.md +++ b/docs/csharp/programming-guide/events/how-to-implement-interface-events.md @@ -37,10 +37,7 @@ An [interface](../../../csharp/language-reference/keywords/interface.md) can dec } protected virtual void OnShapeChanged(MyEventArgs e) { - if(ShapeChanged != null) - { - ShapeChanged(this, e); - } + ShapeChanged?.Invoke(this, e); } } @@ -48,9 +45,9 @@ An [interface](../../../csharp/language-reference/keywords/interface.md) can dec ``` ## Example - The following example shows how to handle the less-common situation in which your class inherits from two or more interfaces and each interface has an event with the same name. In this situation, you must provide an explicit interface implementation for at least one of the events. When you write an explicit interface implementation for an event, you must also write the `add` and `remove` event accessors. Normally these are provided by the compiler, but in this case the compiler cannot provide them. +The following example shows how to handle the less-common situation in which your class inherits from two or more interfaces and each interface has an event with the same name. In this situation, you must provide an explicit interface implementation for at least one of the events. When you write an explicit interface implementation for an event, you must also write the `add` and `remove` event accessors. Normally these are provided by the compiler, but in this case the compiler cannot provide them. - By providing your own accessors, you can specify whether the two events are represented by the same event in your class, or by different events. For example, if the events should be raised at different times according to the interface specifications, you can associate each event with a separate implementation in your class. In the following example, subscribers determine which `OnDraw` event they will receive by casting the shape reference to either an `IShape` or an `IDrawingObject`. +By providing your own accessors, you can specify whether the two events are represented by the same event in your class, or by different events. For example, if the events should be raised at different times according to the interface specifications, you can associate each event with a separate implementation in your class. In the following example, subscribers determine which `OnDraw` event they will receive by casting the shape reference to either an `IShape` or an `IDrawingObject`. [!code-csharp[csProgGuideEvents#10](../../../csharp/programming-guide/events/codesnippet/CSharp/how-to-implement-interface-events_1.cs)] From 4b36aba520da4fd7661141006c0f37bd1ea8f3df Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Tue, 12 Jun 2018 17:53:19 +0200 Subject: [PATCH 10/10] Include Windows 10 Version numbers (#5643) * Include Windows 10 Version numbers The version namings and version numbers of Windows 10 is not really descriptive, because on some sites (e.g. the [lifecycle description](https://support.microsoft.com/de-ch/help/13853/windows-lifecycle-fact-sheet) page ) the version number is used. The get a better sense what is included or not I added the version number. * adding "version" in front of the actual version number --- .../migration-guide/versions-and-dependencies.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/framework/migration-guide/versions-and-dependencies.md b/docs/framework/migration-guide/versions-and-dependencies.md index 2574def13cd7c..ad7b13fe0a293 100644 --- a/docs/framework/migration-guide/versions-and-dependencies.md +++ b/docs/framework/migration-guide/versions-and-dependencies.md @@ -24,11 +24,11 @@ Each version of the .NET Framework contains the common language runtime (CLR), t |.NET Framework version|CLR version|Features|Included in Visual Studio version|✓ Included in
+ Can be installed on
Windows|✓ Included in
+ Can be installed on
Windows Server|To determine installed .NET version| |----------------------------|-----------------|--------------|---------------------------------------|----------------------------------------------------|-----------------------------------------------------------|-----------------------------------------| -|4.7.2|4|- Numerous cryptographic enhancements.
- Improved performance when decompressing ZIP archives.
- Additional APIs in collection classes.
- Support for dependency injection in Web Forms.
- Support for same-site cookies in ASP.NET.
- Implementation of additional properties.
-SQLClient support for Azure Active Directory Universal Authentication and Multi-factor authentication.
- SqlClient support for enclave-based Always Encrypted.
- Support in WPF for finding ResourceDictionaries by source, for finding ResourceDictionary owners, and for finding StaticResource references.
-Support for deploying HDPI-aware applications for Windows Forms, WPF, and Visual Studio Tools for Office (VSTO) using ClickOnce.
- Numerous accessibility improvements; see [What's new in accessibility in the .NET Framework](../whats-new/whats-new-in-accessibility.md).| |✓ 10 April 2018 Update

+ 10 Fall Creators Update

+ 10 Creators Update
+ 10 Anniversary Update
+ 8.1
+7 | + 2016
+ 2012 R2
+ 2012
+ 2008 R2 SP1 |Use `Release` DWORD:

- 461808 (Windows 10 April 2018 Update)
- 461814 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| -|4.7.1|4|- Built-in support for .NET Standard 2.0.
- Support for configuration builders, allowing the creation of configuration files at runtime.
- Runtime feature detection, which allows you to determine whether a predefined feature is supported in the runtime environment.
- Serializable value tuples.
- Improved performance for garbage collection.
- Support for portable PDBs.
- SHA-2 support for .
- Support for ASP.NET cookie parsing with the method.
- Support for SHA-2 hashing for ASP.NET forms authentication credentials.
- Numerous accessibility improvements for app developers; see [What's new in accessibility in the .NET Framework](../whats-new/whats-new-in-accessibility.md).| | ✓ 10 Fall Creators Update

+ 10 Creators Update
+ 10 Anniversary Update
+ 8.1
+7| + 2016
+ 2012 R2
+ 2012
+ 2008 R2 SP1 |Use `Release` DWORD:

- 461308 (Windows 10 Creators Update)
- 461310 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| -|4.7|4|- Support for the level of TLS support provided by the operating system.
- Ability to configure default message security settings for TLS1.1 or TLS1.2.
- Improved reliability of the .
- Improved reliability of serialization and deserialization with WCF applications.
- Ability to extend the ASP.NET object cache.
- Support for a touch/stylus stack based on `WM_POINTER` Windows messages instead of the Windows Ink Services Platform (WISP) for WPF applications.
- Use of Window's Print Document Package API for printing in WPF applications.
- Enhanced high DPI and multi-monitor support for Windows Forms applications running on Windows 10 Creators Update. | | ✓ 10 Creators Update

+ 10 Anniversary Update
+ 8.1
+7| + 2016
+ 2012 R2
+ 2012
+ 2008 R2 SP1 |Use `Release` DWORD:

- 460798 (Windows 10 Creators Update)
- 460805 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md)) | -|4.6.2|4|- Cryptography enhancements, including support for X509 certificates containing FIS 186-3 DSA, support for persisted-key symmetric encryption, support for SHA-2 hashing, and increased clarity for inputs to ECDiffieHellman key derivation routines.
- For Windows Presentation Foundation (WPF) apps, soft keyboard support, and per-monitor DPI.
- ClickOnce support for the TLS 1.1 and TLS 1.2 protocols.
- Support for converting Windows Forms and WPF apps to UWP apps.||✓ 10 Anniversary Update

+ 10 November Update
+ 10
+ 8.1
+ 7|✓ 2016

+ 2012 R2
+ 2012
+ 2008 R2 SP1|Use `Release` DWORD:

- 394802 (Windows 10 Anniversary Update)
- 394806 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| -|4.6.1|4|- Support for X509 certificates containing ECDSA
- Always Encrypted support for hardware protected keys in ADO.NET
- Spell checking improvements in WPF
- [More...](../../../docs/framework/whats-new/index.md)||✓ 10 November Update

+ 10
+ 8.1
+ 8
+ 7|+ 2012 R2
+ 2012
+ 2008 R2 SP1|Use `Release` DWORD:

- 394254 (Windows 10 November Update)
- 394271 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| +|4.7.2|4|- Numerous cryptographic enhancements.
- Improved performance when decompressing ZIP archives.
- Additional APIs in collection classes.
- Support for dependency injection in Web Forms.
- Support for same-site cookies in ASP.NET.
- Implementation of additional properties.
-SQLClient support for Azure Active Directory Universal Authentication and Multi-factor authentication.
- SqlClient support for enclave-based Always Encrypted.
- Support in WPF for finding ResourceDictionaries by source, for finding ResourceDictionary owners, and for finding StaticResource references.
-Support for deploying HDPI-aware applications for Windows Forms, WPF, and Visual Studio Tools for Office (VSTO) using ClickOnce.
- Numerous accessibility improvements; see [What's new in accessibility in the .NET Framework](../whats-new/whats-new-in-accessibility.md).| |✓ 10 April 2018 Update (Version 1803)

+ 10 Fall Creators Update (Version 1709)

+ 10 Creators Update (Version 1703)
+ 10 Anniversary Update (Version 1607)
+ 8.1
+7 | + 2016
+ 2012 R2
+ 2012
+ 2008 R2 SP1 |Use `Release` DWORD:

- 461808 (Windows 10 April 2018 Update)
- 461814 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| +|4.7.1|4|- Built-in support for .NET Standard 2.0.
- Support for configuration builders, allowing the creation of configuration files at runtime.
- Runtime feature detection, which allows you to determine whether a predefined feature is supported in the runtime environment.
- Serializable value tuples.
- Improved performance for garbage collection.
- Support for portable PDBs.
- SHA-2 support for .
- Support for ASP.NET cookie parsing with the method.
- Support for SHA-2 hashing for ASP.NET forms authentication credentials.
- Numerous accessibility improvements for app developers; see [What's new in accessibility in the .NET Framework](../whats-new/whats-new-in-accessibility.md).| | ✓ 10 Fall Creators Update (Version 1709)

+ 10 Creators Update (Version 1703)
+ 10 Anniversary Update (Version 1607)
+ 8.1
+7| + 2016
+ 2012 R2
+ 2012
+ 2008 R2 SP1 |Use `Release` DWORD:

- 461308 (Windows 10 Creators Update)
- 461310 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| +|4.7|4|- Support for the level of TLS support provided by the operating system.
- Ability to configure default message security settings for TLS1.1 or TLS1.2.
- Improved reliability of the .
- Improved reliability of serialization and deserialization with WCF applications.
- Ability to extend the ASP.NET object cache.
- Support for a touch/stylus stack based on `WM_POINTER` Windows messages instead of the Windows Ink Services Platform (WISP) for WPF applications.
- Use of Window's Print Document Package API for printing in WPF applications.
- Enhanced high DPI and multi-monitor support for Windows Forms applications running on Windows 10 Creators Update. | | ✓ 10 Creators Update (Version 1703)

+ 10 Anniversary Update (Version 1607)
+ 8.1
+7| + 2016
+ 2012 R2
+ 2012
+ 2008 R2 SP1 |Use `Release` DWORD:

- 460798 (Windows 10 Creators Update)
- 460805 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md)) | +|4.6.2|4|- Cryptography enhancements, including support for X509 certificates containing FIS 186-3 DSA, support for persisted-key symmetric encryption, support for SHA-2 hashing, and increased clarity for inputs to ECDiffieHellman key derivation routines.
- For Windows Presentation Foundation (WPF) apps, soft keyboard support, and per-monitor DPI.
- ClickOnce support for the TLS 1.1 and TLS 1.2 protocols.
- Support for converting Windows Forms and WPF apps to UWP apps.||✓ 10 Anniversary Update (Version 1607)

+ 10 November Update (Version 1511)
+ 10
+ 8.1
+ 7|✓ 2016

+ 2012 R2
+ 2012
+ 2008 R2 SP1|Use `Release` DWORD:

- 394802 (Windows 10 Anniversary Update)
- 394806 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| +|4.6.1|4|- Support for X509 certificates containing ECDSA
- Always Encrypted support for hardware protected keys in ADO.NET
- Spell checking improvements in WPF
- [More...](../../../docs/framework/whats-new/index.md)||✓ 10 November Update (Version 1511)

+ 10
+ 8.1
+ 8
+ 7|+ 2012 R2
+ 2012
+ 2008 R2 SP1|Use `Release` DWORD:

- 394254 (Windows 10 November Update)
- 394271 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| |4.6|4|- Compilation using .NET Native
- ASP.NET Core 5
- Event tracing improvements
- Support for page encodings
- [More...](../../../docs/framework/whats-new/index.md)|2015, although some .NET libraries are available on [NuGet](https://www.nuget.org/). For more information see, [The .NET Framework and Out-of-Band Releases](../../../docs/framework/get-started/the-net-framework-and-out-of-band-releases.md).|✓ 10
+ 8.1
+ 8
+ 7
+ Vista|+ 2012 R2
+ 2012
+ 2008 R2 SP1
+ 2008 SP2|Use `Release` DWORD:

- 393295 (Windows 10)
- 393297 (all other OS versions)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| |4.5.2|4|- New APIs for transactional systems and ASP.NET
- System DPI resizing in Windows Forms controls
- Profiling improvements
- ETW and stress logging improvements
- [More...](../../../docs/framework/whats-new/index.md)|-|+ 8.1
+ 8
+ 7
+ Vista|+ 2012 R2
+ 2012
+ 2008 R2 SP1
+ 2008 SP2|Use `Release` DWORD: 379893
(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))| |4.5.1|4|- Support for Windows Phone Store apps
- Automatic binding redirection
- Performance and debugging improvements
- [More...](../../../docs/framework/whats-new/index.md)|2013|✓ 8.1
+ 8
+ 7
+ Vista|✓ 2012 R2
+ 2012
+ 2008 R2 SP1
+ 2008 SP2|Use `Release` DWORD:

- 378675 (Windows 8.1)
- 378758 (all other)

(see [instructions](../../../docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md))|