Table of Contents

Class DotNetInstaller

Namespace
FishMMO.Installer
Assembly
FishMMO-Installer.dll

Handles ASP.NET Core Runtime installation, dotnet-ef global tool installation, and EF Core migration/database-update commands. Supports Windows and Linux.

public static class DotNetInstaller
Inheritance
DotNetInstaller
Inherited Members

Methods

InstallAspNetRuntime()

Installs the ASP.NET Core runtime for the current platform. On Windows, downloads and runs the official Hosting Bundle EXE. On Linux (Arch/CachyOS, Debian/Ubuntu, RHEL/Fedora), uses the system package manager or falls back to dotnet-install.sh --runtime aspnetcore.

public static Task<bool> InstallAspNetRuntime()

Returns

Task<bool>

True if installation succeeded or runtime was already present.

InstallDotNetEF()

Installs the dotnet-ef global tool if not already present. The .NET SDK itself is a prerequisite for running this installer, so SDK installation is not offered here.

public static Task<bool> InstallDotNetEF()

Returns

Task<bool>

True if dotnet-ef is installed or was already present.

IsAspNetRuntimeInstalledAsync()

Returns true if a compatible ASP.NET Core runtime is present.

public static Task<bool> IsAspNetRuntimeInstalledAsync()

Returns

Task<bool>

IsDotNetEFInstalledAsync()

Checks if DotNet-EF tool is installed globally.

public static Task<bool> IsDotNetEFInstalledAsync()

Returns

Task<bool>

True if installed, otherwise false.

IsDotNetInstalledAsync()

Checks if a compatible DotNet SDK is installed. Uses 'dotnet --list-sdks' to verify SDK availability for build/migration tasks.

public static Task<bool> IsDotNetInstalledAsync()

Returns

Task<bool>

True if installed, otherwise false.

RunDotNetCommandAsync(string, Func<int, string, string, bool>?)

Runs a dotnet command asynchronously, handling environment setup for Linux. Ensures ~/.dotnet/tools is in PATH and DOTNET_ROOT is set on first invocation.

public static Task<bool> RunDotNetCommandAsync(string arguments, Func<int, string, string, bool>? customProcessResult = null)

Parameters

arguments string

DotNet command arguments.

customProcessResult Func<int, string, string, bool>

Optional custom result handler receiving (exitCode, stdout, stderr).

Returns

Task<bool>

True if command succeeded, otherwise false.

RunEFDatabaseUpdateAsync(string?)

Runs a dotnet ef database update command to apply pending migrations.

public static Task<bool> RunEFDatabaseUpdateAsync(string? superuserConnectionString = null)

Parameters

superuserConnectionString string

Returns

Task<bool>

True if the command succeeded, otherwise false.

RunEFMigrationAsync(string)

Runs a dotnet ef migrations add command for the given migration name. EF Core 5.x writes migration files and the model snapshot to the project-local Migrations/ directory. After the command succeeds, generated .cs files are copied to the shared output directory (MigrationsOutputDirectory) so they survive build cleans.

public static Task<bool> RunEFMigrationAsync(string migrationName)

Parameters

migrationName string

Name of the migration to create.

Returns

Task<bool>

True if the command succeeded, otherwise false.