.NET RID 目錄.NET RID Catalog
RID 是執行時間 識別碼 的縮寫。RID is short for Runtime Identifier. RID 值是用來識別應用程式執行所在的目標平台。RID values are used to identify target platforms where the application runs.
.NET 套件會使用它們來代表 NuGet 套件中的平台特定資產。They're used by .NET packages to represent platform-specific assets in NuGet packages. 下列值是 RID 的範例:linux-x64
、ubuntu.14.04-x64
、win7-x64
或 osx.10.12-x64
。The following values are examples of RIDs: linux-x64
, ubuntu.14.04-x64
, win7-x64
, or osx.10.12-x64
.
針對具有原生相依性的套件,RID 也可指定能在哪些平台上還原套件。For the packages with native dependencies, the RID designates on which platforms the package can be restored.
單一 RID 可在您專案檔的 <RuntimeIdentifier>
元素中設定。A single RID can be set in the <RuntimeIdentifier>
element of your project file. 可以在專案檔的 <RuntimeIdentifiers>
元素中,將多個 RID 定義為以分號分隔的清單。Multiple RIDs can be defined as a semicolon-delimited list in the project file's <RuntimeIdentifiers>
element. 您也可以使用 --runtime
下列 .net CLI 命令透過選項來使用它們:They're also used via the --runtime
option with the following .NET CLI commands:
- dotnet builddotnet build
- dotnet cleandotnet clean
- dotnet packdotnet pack
- dotnet publishdotnet publish
- dotnet restoredotnet restore
- dotnet rundotnet run
- dotnet storedotnet store
代表具體作業系統的 RID 通常遵循 [os].[version]-[architecture]-[additional qualifiers]
這個模式,其中:RIDs that represent concrete operating systems usually follow this pattern: [os].[version]-[architecture]-[additional qualifiers]
where:
[os]
是作業/平台系統 Moniker。[os]
is the operating/platform system moniker. 例如:ubuntu
。For example,ubuntu
.[version]
是作業系統版本,使用以點分隔 (.
) 的版本號碼表示。[version]
is the operating system version in the form of a dot-separated (.
) version number. 例如:15.10
。For example,15.10
.- 版本 不應為 行銷版本,因為行銷版本通常代表作業系統的多個個別版本,且具有不同平台 API 介面區。The version shouldn't be marketing versions, as they often represent multiple discrete versions of the operating system with varying platform API surface area.
[architecture]
處理器架構。[architecture]
is the processor architecture. 例如:x86
、x64
、arm
或arm64
。For example:x86
,x64
,arm
, orarm64
.[additional qualifiers]
進一步區分不同平台。[additional qualifiers]
further differentiate different platforms. 例如:aot
。For example:aot
.
RID 圖表RID graph
RID 圖表或執行階段後援圖形是與彼此相容的 RID 清單。The RID graph or runtime fallback graph is a list of RIDs that are compatible with each other. RID 是在 Microsoft.NETCore.Platforms 套件中定義。The RIDs are defined in the Microsoft.NETCore.Platforms package. 您可以在儲存機制中的檔案 runtime.js 中,看到支援的 RID 和 RID 圖形清單 dotnet/runtime
。You can see the list of supported RIDs and the RID graph in the runtime.json file, which is located in the dotnet/runtime
repository. 在此檔案中,您可以看到所有 RID (基底項目除外) 都包含 "#import"
陳述式。In this file, you can see that all RIDs, except for the base one, contain an "#import"
statement. 這些陳述式指出相容的 RID。These statements indicate compatible RIDs.
當 NuGet 還原套件時,它會嘗試尋找與所指定執行階段完全相符的項目。When NuGet restores packages, it tries to find an exact match for the specified runtime. 若找不到完全相符的項目,NuGet 會返回到圖形,直到它根據 RID 圖形找到最接近的相容系統。If an exact match is not found, NuGet walks back the graph until it finds the closest compatible system according to the RID graph.
下列範例是 osx.10.12-x64
RID 的實際項目:The following example is the actual entry for the osx.10.12-x64
RID:
"osx.10.12-x64": {
"#import": [ "osx.10.12", "osx.10.11-x64" ]
}
上述 RID 指定 osx.10.12-x64
匯入 osx.10.11-x64
。The above RID specifies that osx.10.12-x64
imports osx.10.11-x64
. 因此,當 NuGet 還原套件時,它會嘗試在套件中尋找與 osx.10.12-x64
完全相符的項目。So, when NuGet restores packages, it tries to find an exact match for osx.10.12-x64
in the package. 例如,若 NuGet 找不到特定執行階段,它可以還原指定 osx.10.11-x64
執行階段的套件。If NuGet cannot find the specific runtime, it can restore packages that specify osx.10.11-x64
runtimes, for example.
下列範例顯示也在 runtime.json 檔案中定義的稍大 RID 圖形:The following example shows a slightly bigger RID graph also defined in the runtime.json file:
win7-x64 win7-x86
| \ / |
| win7 |
| | |
win-x64 | win-x86
\ | /
win
|
any
所有的 RID 最終將對應至根 any
RID。All RIDs eventually map back to the root any
RID.
處理 RID 時,您必須謹記一些考量:There are some considerations about RIDs that you have to keep in mind when working with them:
- 請勿嘗試剖析 Rid 以取出元件部分。Don't try to parse RIDs to retrieve component parts.
- 不要以程式設計方式建置 RID。Don't build RIDs programmatically.
- 使用已針對平台定義的 RID。Use RIDs that are already defined for the platform.
- RID 必須是特定的,因此不要假設實際 RID 值會怎樣。The RIDs need to be specific, so don't assume anything from the actual RID value.
使用 RIDUsing RIDs
若要使用 RID,必須先了解有哪些 RID 存在。To be able to use RIDs, you have to know which RIDs exist. 新的值會定期新增至平台。New values are added regularly to the platform.
如需最新的完整版本,請參閱存放庫中的 dotnet/runtime
檔案runtime.js。For the latest and complete version, see the runtime.json file in the dotnet/runtime
repository.
可移植 Rid 是新增至 RID 圖形的值,不會系結至特定版本或 OS 散發套件。Portable RIDs are values added to the RID graph that aren't tied to a specific version or OS distribution. 這些是慣用的選擇,特別是在處理多個 Linux 散發版本時,因為大部分的散發 Rid 都對應到可移植 Rid。They are the preferred choice, especially when dealing with multiple Linux distros since most distribution RIDs are mapped to the portable RIDs.
下列清單顯示用於每個 OS 的一小部分最常見 RID。The following list shows a small subset of the most common RIDs used for each OS.
Windows RIDWindows RIDs
僅列出常見值。Only common values are listed. 如需最新的完整版本,請參閱存放庫中的 dotnet/runtime
檔案runtime.js。For the latest and complete version, see the runtime.json file in the dotnet/runtime
repository.
- 可攜式Portable
win-x64
win-x86
win-arm
win-arm64
- Windows 7/Windows Server 2008 R2Windows 7 / Windows Server 2008 R2
win7-x64
win7-x86
- Windows 8.1/Windows Server 2012 R2Windows 8.1 / Windows Server 2012 R2
win81-x64
win81-x86
win81-arm
- Windows 10/Windows Server 2016Windows 10 / Windows Server 2016
win10-x64
win10-x86
win10-arm
win10-arm64
如需詳細資訊,請參閱 .Net 相依性 和需求。For more information, see .NET dependencies and requirements.
Linux RIDLinux RIDs
僅列出常見值。Only common values are listed. 如需最新的完整版本,請參閱存放庫中的 dotnet/runtime
檔案runtime.js。For the latest and complete version, see the runtime.json file in the dotnet/runtime
repository. 如果下方未列出裝置執行的發行版本,裝置可能可以使用其中一個可攜式 RID。Devices running a distribution not listed below may work with one of the Portable RIDs. 例如,如果 Raspberry Pi 裝置執行未列出的 Linux 發行版本,則可以 linux-arm
為目標。For example, Raspberry Pi devices running a Linux distribution not listed can be targeted with linux-arm
.
- 可攜式Portable
linux-x64
(大部分的桌面散發套件,例如 CentOS、Debian、Fedora、Ubuntu 和衍生)linux-x64
(Most desktop distributions like CentOS, Debian, Fedora, Ubuntu, and derivatives)linux-musl-x64
(使用 musl 的輕量發行版本,如 Alpine Linux)linux-musl-x64
(Lightweight distributions using musl like Alpine Linux)linux-arm
在 ARM 上執行的 (Linux 散發套件,例如 Raspberry Pi 模型 2 +) 上的 Raspbianlinux-arm
(Linux distributions running on ARM like Raspbian on Raspberry Pi Model 2+)linux-arm64
在 Raspberry Pi 模型 3 +) 上執行于64位 ARM 上的 (Linux 散發套件(如 Ubuntu Server 64 位)linux-arm64
(Linux distributions running on 64-bit ARM like Ubuntu Server 64-bit on Raspberry Pi Model 3+)
- Red Hat Enterprise LinuxRed Hat Enterprise Linux
rhel-x64
(RHEL 6 版以上已由linux-x64
取代)rhel-x64
(Superseded bylinux-x64
for RHEL above version 6)rhel.6-x64
- TizenTizen
tizen
tizen.4.0.0
tizen.5.0.0
如需詳細資訊,請參閱 .Net 相依性 和需求。For more information, see .NET dependencies and requirements.
macOS RIDmacOS RIDs
macOS RID 使用較舊的 "OSX" 商標。macOS RIDs use the older "OSX" branding. 僅列出常見值。Only common values are listed. 如需最新的完整版本,請參閱存放庫中的 dotnet/runtime
檔案runtime.js。For the latest and complete version, see the runtime.json file in the dotnet/runtime
repository.
- 可攜式Portable
osx-x64
(最低 OS 版本為 macOS 10.12 Sierra)osx-x64
(Minimum OS version is macOS 10.12 Sierra)
- macOS 10.10 YosemitemacOS 10.10 Yosemite
osx.10.10-x64
- macOS 10.11 El CapitanmacOS 10.11 El Capitan
osx.10.11-x64
- macOS 10.12 SierramacOS 10.12 Sierra
osx.10.12-x64
- macOS 10.13 High SierramacOS 10.13 High Sierra
osx.10.13-x64
- macOS 10.14 MojavemacOS 10.14 Mojave
osx.10.14-x64
- macOS 10.15 CatalinamacOS 10.15 Catalina
osx.10.15-x64
- macOS 11.01 Big SurmacOS 11.01 Big Sur
osx.11.0-x64
osx.11.0-arm64
如需詳細資訊,請參閱 .Net 相依性 和需求。For more information, see .NET dependencies and requirements.