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
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
IsAspNetRuntimeInstalledAsync()
Returns true if a compatible ASP.NET Core runtime is present.
public static Task<bool> IsAspNetRuntimeInstalledAsync()
Returns
IsDotNetEFInstalledAsync()
Checks if DotNet-EF tool is installed globally.
public static Task<bool> IsDotNetEFInstalledAsync()
Returns
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
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
argumentsstringDotNet command arguments.
customProcessResultFunc<int, string, string, bool>Optional custom result handler receiving (exitCode, stdout, stderr).
Returns
RunEFDatabaseUpdateAsync(string?)
Runs a dotnet ef database update command to apply pending migrations.
public static Task<bool> RunEFDatabaseUpdateAsync(string? superuserConnectionString = null)
Parameters
superuserConnectionStringstring
Returns
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
migrationNamestringName of the migration to create.