Improved Pandoc handling on dev environments (#634)
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-01-20 10:34:04 +01:00
1 parent f84ea772b4
commit c9f037bb2c
6 files changed
+251 -50

No files matched your search

+32
View File
@@ -1,7 +1,39 @@
using System.Runtime.InteropServices;
namespace SharedTools;
public static class RIDExtensions
{
/// <summary>
/// Detects the current Runtime Identifier (RID) at runtime based on OS and architecture.
/// </summary>
/// <remarks>
/// This method should be preferred over reading the RID from metadata,
/// as the metadata may contain stale values in development environments.
/// </remarks>
/// <returns>The detected RID for the current platform.</returns>
public static RID GetCurrentRID()
{
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
var isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
var isMacOS = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
var arch = RuntimeInformation.OSArchitecture;
return (isWindows, isLinux, isMacOS, arch) switch
{
(true, _, _, Architecture.X64) => RID.WIN_X64,
(true, _, _, Architecture.Arm64) => RID.WIN_ARM64,
(_, true, _, Architecture.X64) => RID.LINUX_X64,
(_, true, _, Architecture.Arm64) => RID.LINUX_ARM64,
(_, _, true, Architecture.X64) => RID.OSX_X64,
(_, _, true, Architecture.Arm64) => RID.OSX_ARM64,
_ => RID.NONE,
};
}
public static string AsMicrosoftRid(this RID rid) => rid switch
{
RID.WIN_X64 => "win-x64",