Skip to content

Commit

Permalink
Merge pull request #13196 from tmds/update_packaging_guidelines
Browse files Browse the repository at this point in the history
Update package guidelines for .NET Core 3.0
  • Loading branch information
leecow authored Sep 5, 2019
2 parents 9bbd06d + 33b4c5d commit 6bb3ede
Showing 1 changed file with 99 additions and 43 deletions.
142 changes: 99 additions & 43 deletions docs/core/build/distribution-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,34 @@ When installed, .NET Core consists of several components that are laid out as fo
├── sdk
│ ├── <sdk version> (3)
│ └── NuGetFallbackFolder (4)
└── shared
├── Microsoft.NETCore.App
│ └── <runtime version> (5)
└── Microsoft.AspNetCore.App
└── <aspnetcore version> (6)
└── Microsoft.AspNetCore.All
└── <aspnetcore version> (7)
├── packs
│ ├── Microsoft.AspNetCore.App.Ref
│ │ └── <aspnetcore ref version> (11)
│ ├── Microsoft.NETCore.App.Ref
│ │ └── <netcore ref version> (12)
│ ├── Microsoft.NETCore.App.Host.<rid>
│ │ └── <apphost version> (13)
│ ├── Microsoft.WindowsDesktop.App.Ref
│ │ └── <desktop ref version> (14)
│ └── NETStandard.Library.Ref
│ └── <netstandard version> (15)
├── shared
│ ├── Microsoft.NETCore.App
│ │ └── <runtime version> (5)
│ ├── Microsoft.AspNetCore.App
│ │ └── <aspnetcore version> (6)
│ ├── Microsoft.AspNetCore.All
│ │ └── <aspnetcore version> (6)
│ └── Microsoft.WindowsDesktop.App
│ └── <desktop app version> (7)
└── templates
│ └── <templates version> (17)
/
├─usr/share/man/man1
├── etc/dotnet
│ └── install_location (16)
├── usr/share/man/man1
│ └── dotnet.1.gz (9)
└─usr/bin
└─usr/bin
└── dotnet (10)
```

Expand All @@ -49,18 +66,32 @@ While there's a single host, most of the other components are in versioned direc

- (3) **sdk/\<sdk version>** The SDK (also known as "the tooling") is a set of managed tools that are used to write and build .NET Core libraries and applications. The SDK includes the .NET Core Command-line interface (CLI), the managed languages compilers, MSBuild, and associated build tasks and targets, NuGet, new project templates, and so on.

- (4) **sdk/NuGetFallbackFolder** contains a cache of NuGet packages used by an SDK during the restore operation, such as when running `dotnet restore` or `dotnet build /t:Restore`.
- (4) **sdk/NuGetFallbackFolder** contains a cache of NuGet packages used by an SDK during the restore operation, such as when running `dotnet restore` or `dotnet build /t:Restore`. This folder is only used prior to .NET Core 3.0. It can't be built from source, because it contains prebuilt binary assets from `nuget.org`.

The **shared** folder contains frameworks. A shared framework provides a set of libraries at a central location so they can be used by different applications.

- (5) **shared/Microsoft.NETCore.App/\<runtime version>** This framework contains the .NET Core runtime and supporting managed libraries.

- (6,7) **shared/Microsoft.AspNetCore.{App,All}/\<aspnetcore version>** contains the ASP.NET Core libraries. The libraries under `Microsoft.AspNetCore.App` are developed and supported as part of the .NET Core project. The libraries under `Microsoft.AspNetCore.All` are a superset that also contains third-party libraries.
- (6) **shared/Microsoft.AspNetCore.{App,All}/\<aspnetcore version>** contains the ASP.NET Core libraries. The libraries under `Microsoft.AspNetCore.App` are developed and supported as part of the .NET Core project. The libraries under `Microsoft.AspNetCore.All` are a superset that also contains third-party libraries.

- (7) **shared/Microsoft.Desktop.App/\<desktop app version>** contains the Windows desktop libraries. This isn't included on non-Windows platforms.

- (8) **LICENSE.txt,ThirdPartyNotices.txt** are the .NET Core license and licenses of third-party libraries used in .NET Core, respectively.

- (9,10) **dotnet.1.gz, dotnet** `dotnet.1.gz` is the dotnet manual page. `dotnet` is a symlink to the dotnet host(1). These files are installed at well known locations for system integration.

- (11,12) **Microsoft.NETCore.App.Ref,Microsoft.AspNetCore.App.Ref** describe the API of an `x.y` version of .NET Core and ASP.NET Core respectively. These packs are used when compiling for those target versions.

- (13) **Microsoft.NETCore.App.Host.\<rid>** contains a native binary for platform `rid`. This binary is a template when compiling a .NET Core application into a native binary for that platform.

- (14) **Microsoft.WindowsDesktop.App.Ref** describes the API of `x.y` version of Windows Desktop applications. These files are used when compiling for that target. This isn't provided on non-Windows platforms.

- (15) **NETStandard.Library.Ref** describes the netstandard `x.y` API. These files are used when compiling for that target.

- (16) **/etc/dotnet/install_location** is a file that contains the full path to the folder that contains the `dotnet` host binary. The path may be terminated with a newline. It's not necessary to add this file when the root is `/usr/share/dotnet`.

- (17) **templates** contains the templates used by the SDK. For example, `dotnet new` finds project templates here.

## Recommended packages

.NET Core versioning is based on the runtime component `[major].[minor]` version numbers.
Expand All @@ -70,50 +101,75 @@ For example: SDK version 2.2.302 is the second patch release of the third featur
Some of the packages include part of the version number in their name. This allows you to install a specific version.
The rest of the version isn't included in the version name. This allows the OS package manager to update the packages (for example, automatically installing security fixes). Supported package managers are Linux specific.

The following table shows the recommended packages:
The following lists the recommended packages:

| Name | Example | Use case: Install ... | Contains | Dependencies | Version |
|-----------------------------------------|------------------------|---------------------------------|--------------------|------------------------------------------------|--------------------|
| dotnet-sdk-[major] | dotnet-sdk-2 | Latest sdk for runtime major | | dotnet-sdk-[major].[latestminor] | \<sdk version> |
| dotnet-sdk-[major].[minor] | dotnet-sdk-2.1 | Latest sdk for specific runtime | | dotnet-sdk-[major].[minor].[latest sdk feat]xx | \<sdk version> |
| dotnet-sdk-[major].[minor].[sdk feat]xx | dotnet-sdk-2.1.3xx | Specific sdk feature release | (3),(4) | aspnetcore-runtime-[major].[minor] | \<sdk version> |
| aspnetcore-runtime-[major].[minor] | aspnetcore-runtime-2.1 | Specific ASP.NET Core runtime | (6),[(7)] | dotnet-runtime-[major].[minor] | \<runtime version> |
| dotnet-runtime-[major].[minor] | dotnet-runtime-2.1 | Specific runtime | (5) | host-fxr:\<runtime version>+ | \<runtime version> |
| dotnet-host-fxr | dotnet-host-fxr | _dependency_ | (2) | host:\<runtime version>+ | \<runtime version> |
| dotnet-host | dotnet-host | _dependency_ | (1),(8),(9),(10) | | \<runtime version> |
* `dotnet-sdk-[major].[minor]` - Installs the latest sdk for specific runtime
* **Version:** \<runtime version>
* **Example:** dotnet-sdk-2.1
* **Contains:** (3),(4)
* **Dependencies:** `aspnetcore-runtime-[major].[minor]`, `dotnet-targeting-pack-[major].[minor]`, `aspnetcore-targeting-pack-[major].[minor]`, `netstandard-targeting-pack-[netstandard_major].[netstandard_minor]`, `dotnet-apphost-pack-[major].[minor]`, `dotnet-templates-[major].[minor]`

Most distributions require all artifacts to be built from source. This has some impact on the packages:
* `aspnetcore-runtime-[major].[minor]` - Installs a specific ASP.NET Core runtime
* **Version:** \<aspnetcore runtime version>
* **Example:** aspnetcore-runtime-2.1
* **Contains:** (6)
* **Dependencies:** `dotnet-runtime-[major].[minor]`

- The third-party libraries under `shared/Microsoft.AspNetCore.All` can't be easily built from source. So that folder is omitted from the `aspnetcore-runtime` package.
* `dotnet-runtime-deps-[major].[minor]` _(Optional)_ - Installs the dependencies for running self-contained applications
* **Version:** \<runtime version>
* **Example:** dotnet-runtime-deps-2.1
* **Dependencies:** _distro specific dependencies_

- The `NuGetFallbackFolder` is populated using binary artifacts from `nuget.org`. It should remain empty.
* `dotnet-runtime-[major].[minor]` - Installs a specific runtime
* **Version:** \<runtime version>
* **Example:** dotnet-runtime-2.1
* **Contains:** (5)
* **Dependencies:** `dotnet-hostfxr:<runtime version>+`, `dotnet-runtime-deps-[major].[minor]`

Multiple `dotnet-sdk` packages may provide the same files for the `NuGetFallbackFolder`. To avoid issues with the package manager, these files should be identical (checksum, modification date, and so on).
* `dotnet-hostfxr` - dependency
* **Version:** \<runtime version>
* **Example:** dotnet-hostfxr
* **Contains:** (2)
* **Dependencies:** `host:<runtime version>+`

### Preview versions
* `dotnet-host` - dependency
* **Version:** \<runtime version>
* **Example:** dotnet-host
* **Contains:** (1),(8),(9),(10),(16)

Package maintainers may decide to provide preview versions of the shared framework and SDK. Preview releases may be provided using the `dotnet-sdk-[major].[minor].[sdk feat]xx`, `aspnetcore-runtime-[major].[minor]`, or `dotnet-runtime-[major].[minor]` packages. For preview releases, the package version major must be set to zero. This way, the final release is installed as an upgrade of the package.
* `dotnet-apphost-pack-[major].[minor]` - dependency
* **Version:** \<runtime version>
* **Contains:** (13)

### Patch packages
* `dotnet-targeting-pack-[major].[minor]` - Allows targeting a non-latest runtime
* **Version:** \<runtime version>
* **Contains:** (12)

Since a patch version of a package may cause a breaking change, a package maintainer may want to provide _patch packages_. These packages allow you to install a specific patch version that isn't automatically upgraded. Only use patch packages in rare circumstances as they aren't upgraded with (security) fixes.
* `aspnetcore-targeting-pack-[major].[minor]` - Allows targeting a non-latest runtime
* **Version:** \<aspnetcore runtime version>
* **Contains:** (11)

The following table shows the recommended packages and **patch packages**:
* `netstandard-targeting-pack-[major].[minor]` - Allows targeting a netstandard version
* **Version:** \<sdk version>
* **Contains:** (15)

| Name | Example | Contains | Dependencies |
|------------------------------------------------|--------------------------|------------------|-----------------------------------------------------------|
| dotnet-sdk-[major] | dotnet-sdk-2 | | dotnet-sdk-[major].[latest sdk minor] |
| dotnet-sdk-[major].[minor] | dotnet-sdk-2.1 | | dotnet-sdk-[major].[minor].[latest sdk feat]xx |
| dotnet-sdk-[major].[minor].[sdk feat]xx | dotnet-sdk-2.1.3xx | | dotnet-sdk-[major].[minor].[latest sdk patch] |
| **dotnet-sdk-[major].[minor].[patch]** | dotnet-sdk-2.1.300 | (3),(4) | aspnetcore-runtime-[major].[minor].[sdk runtime patch] |
| aspnetcore-runtime-[major].[minor] | aspnetcore-runtime-2.1 | | aspnetcore-runtime-[major].[minor].[latest runtime patch] |
| **aspnetcore-runtime-[major].[minor].[patch]** | aspnetcore-runtime-2.1.0 | (6),[(7)] | dotnet-runtime-[major].[minor].[patch] |
| dotnet-runtime-[major].[minor] | dotnet-runtime-2.1 | | dotnet-runtime-[major].[minor].[latest runtime patch] |
| **dotnet-runtime-[major].[minor].[patch]** | dotnet-runtime-2.1.0 | (5) | host-fxr:\<runtime version>+ |
| dotnet-host-fxr | dotnet-host-fxr | (2) | host:\<runtime version>+ |
| dotnet-host | dotnet-host | (1),(8),(9),(10) | |
* `dotnet-templates-[major].[minor]`
* **Version:** \<sdk version>
* **Contains:** (15)

An alternative to using patch packages is _pinning_ the packages to a specific version using the package manager. To avoid affecting other applications/users, such applications can be built and deployed in a container.
The `dotnet-runtime-deps-[major].[minor]` requires understanding the _distro specific dependencies_. Because the distro build system may be able to derive this automatically, the package is optional, in which case these dependencies are added directly to the `dotnet-runtime-[major].[minor]` package.

When package content is under a versioned folder, the package name `[major].[minor]` match the versioned folder name. For all packages, except the `netstandard-targeting-pack-[major].[minor]`, this also matches with the .NET Core version.

Dependencies between packages should use a _equal or greater than_ version requirement. For example, `dotnet-sdk-2.2:2.2.401` requires `aspnetcore-runtime-2.2 >= 2.2.6`. This makes it possible for the user to upgrade their installation via a root package (e.g. `dnf update dotnet-sdk-2.2`).

Most distributions require all artifacts to be built from source. This has some impact on the packages:

- The third-party libraries under `shared/Microsoft.AspNetCore.All` can't be easily built from source. So that folder is omitted from the `aspnetcore-runtime` package.

- The `NuGetFallbackFolder` is populated using binary artifacts from `nuget.org`. It should remain empty.

Multiple `dotnet-sdk` packages may provide the same files for the `NuGetFallbackFolder`. To avoid issues with the package manager, these files should be identical (checksum, modification date, and so on).

## Building packages

Expand Down

0 comments on commit 6bb3ede

Please sign in to comment.