Skip to content

Commit 702d5ff

Browse files
authored
Merge pull request #6304 from dotnet/master
Update Live with current Master
2 parents 4c158be + 28d25bb commit 702d5ff

File tree

7 files changed

+180
-34
lines changed

7 files changed

+180
-34
lines changed

docs/core/deploying/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ There are also a few disadvantages:
3636

3737
## Self-contained deployments (SCD)
3838

39-
For a self-contained deployment, you deploy your app and any required third-party dependencies along with the version of .NET Core that you used to build the app. Creating an SCD doesn't include the [native dependencies of .NET Core](https://github.com/dotnet/core/blob/master/Documentation/prereqs.md) on various platforms, so these must be present before the app runs.
39+
For a self-contained deployment, you deploy your app and any required third-party dependencies along with the version of .NET Core that you used to build the app. Creating an SCD doesn't include the [native dependencies of .NET Core](https://github.com/dotnet/core/blob/master/Documentation/prereqs.md) on various platforms, so these must be present before the app runs. For more information on version binding at runtime, see the article on [version binding in .NET Core](../versions/selection.md)
4040

4141
FDD and SCD deployments use separate host executables, so you can sign a host executable for an SCD with your publisher signature.
4242

docs/core/get-started.md

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,82 @@
11
---
22
title: Get started with .NET Core
33
description: Find resources to learn how to build .NET Core applications on Windows, Linux and macOS.
4-
author: johalex
5-
ms.author: johalex
6-
ms.date: 09/14/2017
4+
author: thraka
5+
ms.author: adegeo
6+
ms.date: 06/27/2018
77
---
8+
89
# Get started with .NET Core
910

10-
.NET Core runs on [Windows](#windows), [Linux](#linux), and [macOS / OS X](#os-x--macos).
11+
This article provides information on getting started with .NET Core. .NET Core can be installed on Windows, Linux, and macOS. You can code in your favorite text editor and produce cross-platform libraries and applications.
12+
13+
If you're unsure what .NET Core is, or how it relates to other .NET technologies, start with the [What is .NET](https://www.microsoft.com/net/learn/what-is-dotnet) overview. Put simply, .NET Core is an open-source, cross-platform, implementation of .NET.
14+
15+
## Create an application
16+
17+
First, download and install the [.NET Core SDK](https://www.microsoft.com/net/download/) on your computer.
18+
19+
Next, open a terminal such as **PowerShell**, **Command Prompt**, or **bash**. Type the following `dotnet` commands to create and run a C# application.
20+
21+
```console
22+
dotnet new console --output sample1
23+
dotnet run --project sample1
24+
```
25+
26+
You should see the following output:
27+
28+
```console
29+
Hello World!
30+
```
31+
32+
Congratulations! You've created a simple .NET Core application. You can also use [Visual Studio Code](tutorials/with-visual-studio-code.md), [Visual Studio 2017](tutorials/with-visual-studio.md) (Windows only), or [Visual Studio for Mac](tutorials/using-on-mac-vs.md) (macOS only), to create a .NET Core application.
33+
34+
## Tutorials
35+
36+
You can get started developing .NET Core applications by following these step-by-step tutorials.
37+
38+
# [Windows](#tab/windows)
39+
40+
* [Build a C# "Hello World" Application with .NET Core in Visual Studio 2017.](./tutorials/with-visual-studio.md)
41+
42+
* [Build a C# class library with .NET Core in Visual Studio 2017.](./tutorials/library-with-visual-studio.md)
43+
44+
* [Build a Visual Basic "Hello World" application with .NET Core in Visual Studio 2017.](./tutorials/vb-with-visual-studio.md)
45+
46+
* [Build a class library with Visual Basic and .NET Core in Visual Studio 2017.](./tutorials/vb-library-with-visual-studio.md)
47+
48+
* Watch a video on [how to install and use Visual Studio Code and .NET Core](https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-using-CSharp-and-NET-Core/).
49+
50+
* Watch a video on [how to install and use Visual Studio 2017 and .NET Core](https://channel9.msdn.com/Blogs/dotnet/Get-Started-NET-Core-Visual-Studio-2017/).
51+
52+
* [Getting started with .NET Core using the command-line.](tutorials/using-with-xplat-cli.md)
1153

12-
## Windows
54+
See the [Prerequisites for Windows development](windows-prerequisites.md) article for a list of the supported Windows versions.
1355

14-
Install .NET Core on [Windows](https://www.microsoft.com/net/core#windows).
56+
# [Linux](#tab/linux)
1557

16-
You can get started developing .NET Core apps by following these step-by-step tutorials.
58+
You can get started developing .NET Core application by following these step-by-step tutorials.
1759

18-
* [Building a C# Hello World Application with .NET Core in Visual Studio 2017](./tutorials/with-visual-studio.md) - Learn to build, debug, and publish a simple .NET Core console application using C# and Visual Studio 2017.
19-
* [Building a class library with C# and .NET Core in Visual Studio 2017](./tutorials/library-with-visual-studio.md) - Learn how to build a class library written in C# using Visual Studio 2017.
20-
* [Build a Visual Basic Hello World application with .NET Core in Visual Studio 2017](./tutorials/vb-with-visual-studio.md) - Learn to build, debug, and publish a simple .NET Core console application using Visual Basic and Visual Studio 2017.
21-
* [Build a class library with Visual Basic and .NET Core in Visual Studio 2017](./tutorials/vb-library-with-visual-studio.md) - Learn how to build a class library written in Visual Basic using Visual Studio 2017.
22-
* [Get started with Visual Studio Code using C# and .NET Core on Windows](https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-using-CSharp-and-NET-Core) - This [Channel9](https://channel9.msdn.com) video shows you how to install and use [Visual Studio Code](https://code.visualstudio.com/), Microsoft's lightweight cross-platform code editor, to create your first console application in .NET Core.
23-
* [Get Started with .NET Core and Visual Studio 2017](https://channel9.msdn.com/Blogs/dotnet/Get-Started-NET-Core-Visual-Studio-2017) - This [Channel9](https://channel9.msdn.com) video shows you how to install and use [Visual Studio 2017](https://aka.ms/vsdownload?utm_source=mscom&utm_campaign=msdocs), Microsoft's fully-featured IDE, to create your first cross-platform console application in .NET Core.
24-
* [Getting started with .NET Core using the command-line](tutorials/using-with-xplat-cli.md) - Use any code editor with the [.NET Core cross-platform command-line interface (CLI)](tools/index.md).
60+
* [Getting started with .NET Core using the command-line.](tutorials/using-with-xplat-cli.md)
2561

26-
See the [Prerequisites for Windows development](windows-prerequisites.md) topic for a list of the supported Windows versions.
62+
* Watch a video on [getting started with Visual Studio Code using C# and .NET Core on Ubuntu](https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-Csharp-dotnet-Core-Ubuntu).
2763

28-
## Linux
64+
See the [Prerequisites for Linux development](linux-prerequisites.md) article for a list of the supported Linux distros and versions.
2965

30-
Install .NET Core on [Linux](https://www.microsoft.com/net/core#linuxredhat).
66+
# [macOS](#tab/macos)
3167

32-
You can get started developing .NET Core apps by following these step-by-step tutorials.
68+
You can get started developing .NET Core application by following these step-by-step tutorials.
3369

34-
* [Getting started with .NET Core using the command-line](tutorials/using-with-xplat-cli.md) - Use any code editor with the [.NET Core cross-platform command-line interface (CLI)](tools/index.md).
35-
* [Get started with Visual Studio Code using C# and .NET Core on Ubuntu](https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-Csharp-dotnet-Core-Ubuntu) - This [Channel9](https://channel9.msdn.com) video shows you how to install and use [Visual Studio Code](https://code.visualstudio.com/), Microsoft's lightweight cross-platform code editor, to create your first console application in .NET Core on Ubuntu 14.04.
70+
* Watch a video on [Getting started with Visual Studio Code using C# and .NET Core on macOS](https://channel9.msdn.com/Blogs/dotnet/Get-started-VSCode-NET-Core-Mac).
3671

37-
See the [Prerequisites for Linux development](linux-prerequisites.md) topic for a list of the supported Linux distros and versions.
72+
* [Getting started with .NET Core on macOS, using Visual Studio Code.](tutorials/using-on-macos.md)
3873

39-
## OS X / macOS
74+
* [Getting started with .NET Core using the command-line.](tutorials/using-with-xplat-cli.md)
4075

41-
Install .NET Core for [macOS](https://www.microsoft.com/net/core#macos). .NET Core is supported on OS X El Capitan (version 10.11) and macOS Sierra (version 10.12).
76+
* [Getting started with .NET Core on macOS using Visual Studio for Mac.](tutorials/using-on-mac-vs.md)
4277

43-
You can get started developing .NET Core apps by following these step-by-step tutorials.
78+
* [Build a complete .NET Core solution on macOS using Visual Studio for Mac.](tutorials/using-on-mac-vs-full-solution.md)
4479

45-
* [Get started with Visual Studio Code using C# and .NET Core on macOS](https://channel9.msdn.com/Blogs/dotnet/Get-started-VSCode-NET-Core-Mac) - This [Channel9](https://channel9.msdn.com) video shows you how to install and use [Visual Studio Code](https://code.visualstudio.com/), Microsoft's lightweight cross-platform code editor, to create your first console application in .NET Core.
46-
* [Getting started with .NET Core on macOS, using Visual Studio Code](tutorials/using-on-macos.md) - A tour of the steps and workflow to create a .NET Core Solution using Visual Studio Code that includes unit tests, third-party libraries and how to use the debugging tools.
47-
* [Getting started with .NET Core using the command-line](tutorials/using-with-xplat-cli.md) - Use any code editor with the [.NET Core cross-platform command-line interface (CLI)](tools/index.md).
48-
* [Getting started with .NET Core on macOS using Visual Studio for Mac](tutorials/using-on-mac-vs.md) - This tutorial shows you how to build a simple .NET Core console application using Visual Studio for Mac.
49-
* [Building a complete .NET Core solution on macOS using Visual Studio for Mac](tutorials/using-on-mac-vs-full-solution.md) - This tutorial shows you how to build a complete .NET Core solution that includes a reusable library and unit testing.
80+
See the [Prerequisites for macOS development](macos-prerequisites.md) article for a list of the supported OS X / macOS versions.
5081

51-
See the [Prerequisites for macOS development](macos-prerequisites.md) topic for a list of the supported OS X / macOS versions.
82+
***

docs/core/versions/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ With .NET Core 2.0, downloads show a single version number in their file name. T
2727

2828
The use of a single version number makes it easier for users to know what version of the SDK to install on their dev machines, and what the corresponding version of the shared framework should be when time comes to provision a production environment. When downloading an SDK or runtime, the version number you see is going to be the same.
2929

30+
### Version selection
31+
32+
.NET Core applies a set of policies that determine which versions of the .NET Core runtime and SDK are used in various scenarios. These scenarios and policies are fully explored in the article on [version selection](selection.md).
33+
34+
You can think of these policies as performing the following roles:
35+
36+
* Enable easy and efficient deployment of .NET Core, including security and reliability updates.
37+
* Enable developers to use the latest tools and commands independent of target runtime.
38+
3039
### Installers
3140

3241
With .NET Core 2.0, downloads for the [daily builds](https://github.com/dotnet/core-setup#daily-builds) and [releases](https://www.microsoft.com/net/download/core) adhere to a new naming scheme that is easier to understand.

docs/core/versions/selection.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: .NET Core version selection
3+
description: Learn how .NET Core finds and chooses runtime versions for your program.
4+
author: billwagner
5+
ms.author: wiwagn
6+
ms.date: 06/27/2018
7+
---
8+
# .NET Core version selection
9+
10+
[!INCLUDE [topic-appliesto-net-core-2plus](../../../includes/topic-appliesto-net-core-2plus.md)]
11+
12+
This article explains the policies used by the .NET Core tools, SDK, and runtime for selecting versions. These policies provide a balance between running applications using the specified versions and enabling ease of upgrading both developer and end user machines. These policies perform the following:
13+
14+
- Easy and efficient deployment of .NET Core, including security and reliability updates.
15+
- Use the latest tools and commands independent of target runtime.
16+
17+
Version selection occurs:
18+
19+
- When you run an SDK command, [the sdk uses the latest installed version](#the-sdk-uses-the-latest-installed-version).
20+
- When you build an assembly, [target framework monikers define build time APIs](#target-framework-monikers-define-build-time-apis).
21+
- When you run a .NET Core application, [target framework dependent apps roll forward](#framework-dependent-apps-roll-forward).
22+
- When you publish a self-contained application, [self-contained deployments include the selected runtime](#self-contained-deployments-include-the-selected-runtime).
23+
24+
The rest of this document examines those four scenarios.
25+
26+
## The SDK uses the latest installed version
27+
28+
SDK commands include `dotnet new`, `dotnet build` or `dotnet run`. The `dotnet` CLI must choose an SDK version for any command. The .NET Core CLI uses the latest SDK installed on the machine by default. You'll use the .NET Core SDK v2.1.301 when it's installed, even if the project you are working with targets the .NET Core Runtime 2.0. Note that this is true for preview versions as well as released versions. You can take advantage of the latest SDK features and improvements while targeting earlier .NET Core runtime versions. You can target multiple runtime versions of .NET Core on different projects, using the same SDK tools for all projects.
29+
30+
On rare occasions, you may need to use an earlier version of the SDK. You specify that version in a [*global.json* file](../tools/global-json.md). The "use latest" policy means you only use *global.json* to specify a .NET Core version earlier than the latest installed version.
31+
32+
*global.json* can be placed anywhere in the file hierarchy. The CLI searches upward from the project directory for the first *global.json* it finds. You control which projects a given *global.json* applies to by its place in the file system. The .NET CLI searches for a *global.json* file iteratively navigating the path upward from the current working directory. The first *global.json* file found specifies the version used. If that version is installed, that version is used. If the SDK specified in the *global.json* is not found, the .NET CLI rolls forward to the latest SDK installed. This is the same as the default behavior, when no *global.json** file is found.
33+
34+
The following example shows the *global.json* syntax:
35+
36+
``` json
37+
{
38+
"sdk": {
39+
"version": "2.0.0"
40+
}
41+
}
42+
```
43+
44+
The process for selecting an SDK version is:
45+
46+
1. `dotnet` searches for a *global.json* file iteratively reverse-navigating the path upward from the current working directory.
47+
1. `dotnet` uses the SDK specified in the first *global.json* found.
48+
1. `dotnet` binds to the latest installed SDK if no *global.json* is found.
49+
50+
You can learn more about selecting an SDK version in the [matching rules](../tools/global-json.md) section of the topic on *global.json*.
51+
52+
## Target Framework Monikers define build time APIs
53+
54+
You build your project against APIs defined in a **Target Framework Moniker** (TFM). You specify the [target framework](../../standard/frameworks.md) in the project file. Set the `TargetFramework` element in your project file as shown in the following example:
55+
56+
``` xml
57+
<TargetFramework>netcoreapp2.0</TargetFramework>
58+
```
59+
60+
You may build your project against multiple TFMs. Setting multiple target frameworks is more common for libraries but can be done with applications as well. You specify a `TargetFrameworks` property (plural of `TargetFramework`). The target frameworks are semicolon-delimited as shown in the following example:
61+
62+
``` xml
63+
<TargetFrameworks>netcoreapp2.0;net47</TargetFrameworks>
64+
```
65+
66+
A given SDK supports a fixed set of frameworks, capped to the target framework of the runtime it ships with. For example, the .NET Core 2.0 SDK includes the .NET Core 2.0 runtime, which is an implementation of the `netcoreapp2.0` target framework. The .NET Core 2.0 SDK supports `netcoreapp1.0`, `netcoreapp1.1`, and `netcoreapp2.0` but not `netcoreapp2.1` (or higher). You install the .NET Core 2.1 SDK to build for `netcoreapp2.1`.
67+
68+
.NET Standard target frameworks are also capped to the target framework of the runtime the SDK ships with. The .NET Core 2.0 SDK is capped to `netstandard2.0`.
69+
70+
## Framework-dependent apps roll forward
71+
72+
You run an application from source with [`dotnet run`](../tools/dotnet-run.md). `dotnet run` both builds and runs an application. The `dotnet` executable is the **host** for the application in development environments.
73+
74+
The host chooses the latest patch version installed on the machine. For example, if you specified `netcoreapp2.0` in your project file, and `2.0.4` is the latest .NET runtime installed, the `2.0.4` runtime is used.
75+
76+
If no acceptable `2.0.*` version is found, a new `2.*` version is used. For example, if you specified `netcoreapp2.0` and only `2.1.0` is installed, the application runs using the `2.1.0` runtime. This behavior is referred to as "minor version roll-forward." Lower versions also won't be considered. When no acceptable runtime is installed, the application won't run.
77+
78+
A few usage examples demonstrate the behavior:
79+
80+
- 2.0.4 is required. 2.0.5 is the highest patch version installed. 2.0.5 is used.
81+
- 2.0.4 is required. No 2.0.* versions are installed. 1.1.1 is the highest runtime installed. An error message is displayed.
82+
- 2.04 is required. 2.0.0 is the latest version installed. An error message is displayed.
83+
- 2.0.4 is required. No 2.0.* versions are installed. 2.2.2 is the highest 2.x runtime version installed. 2.2.2 is used.
84+
- 2.0.4 is required. No 2.x versions are installed. 3.0.0 (not a currently available version) is installed. An error message is displayed.
85+
86+
Minor version roll-forward has one side-effect that may affect end users. Consider the following scenario:
87+
88+
- 2.0.4 is required. No 2.0.* versions are installed. 2.2.2 is installed. 2.2.2 is used.
89+
- 2.0.5 is later installed. 2.0.5 will be used for subsequent application launches, not 2.2.2. The latest patch is preferred over an updated minor version.
90+
- It's possible that 2.0.5 and 2.2.2 might behave differently, particularly for scenarios like serializing binary data.
91+
92+
## Self-contained deployments include the selected runtime
93+
94+
You can publish an application as a [**self-contained distribution**](../deploying/index.md#self-contained-deployments-scd). This approach bundles the .NET Core runtime and libraries with your application. Self-contained deployments don't have a dependency on runtime environments. Runtime version selection occurs at publishing time, not run time.
95+
96+
The publishing process selects the latest patch version of the given runtime family. For example, `dotnet publish` will select .NET Core 2.0.4 if it is the latest patch version in the .NET Core 2.0 runtime family. The target framework (including the latest installed security patches) are packaged with the application.
97+
98+
It's an error if the minimum version specified for an application isn't satisfied. `dotnet publish` binds to the latest runtime patch version (within a given major.minor version family). `dotnet publish` doesn't support the roll-forward semantics of `dotnet run`. For more information about patches and self-contained deployments, see the article on [runtime patch selection](../deploying/runtime-patch-selection.md) in deploying .NET Core applications.
99+
100+
Self-contained deployments may require a specific patch version. You can override the minimum runtime patch version (to higher or lower versions) in the project file, as shown in the following example:
101+
102+
``` xml
103+
<RuntimeFrameworkVersion>2.0.4</RuntimeFrameworkVersion>
104+
```
105+
106+
The `RuntimeFrameworkVersion` element overrides the default version policy. For self-contained deployments, the `RuntimeFrameworkVersion` specifies the *exact* runtime framework version. For framework dependent applications, the `RuntimeFrameworkVersion` specifies the *minimum* patch level of the framework.

0 commit comments

Comments
 (0)