diff --git a/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs b/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs index 49ba8af..93d38d5 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs +++ b/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs @@ -24,11 +24,9 @@ IPrerequisite[] missingPrerequisites { using (ConsoleEx.WithForegroundColor(ConsoleColor.DarkRed)) { - Console - .Error - .WriteLine( - $"Your system is missing runtime components required by {targetAssembly.Name}:" - ); + Console.Error.WriteLine( + $"Your system is missing runtime components required by {targetAssembly.Name}:" + ); foreach (var prerequisite in missingPrerequisites) Console.Error.WriteLine($" - {prerequisite.DisplayName}"); @@ -50,11 +48,9 @@ IPrerequisite[] missingPrerequisites // When not running in interactive mode, instruct the user to set the environment variable instead else { - Console - .Error - .Write( - "To install the missing components automatically, set the environment variable " - ); + Console.Error.Write( + "To install the missing components automatically, set the environment variable " + ); using (ConsoleEx.WithForegroundColor(ConsoleColor.DarkCyan)) Console.Error.Write(AcceptPromptEnvironmentVariable); @@ -146,11 +142,9 @@ IPrerequisite[] missingPrerequisites if (isRebootRequired) { using (ConsoleEx.WithForegroundColor(ConsoleColor.DarkYellow)) - Console - .Out - .WriteLine( - $"You need to restart Windows before you can run {targetAssembly.Name}." - ); + Console.Out.WriteLine( + $"You need to restart Windows before you can run {targetAssembly.Name}." + ); // Only prompt for reboot if running in interactive mode if (ConsoleEx.IsInteractive) diff --git a/DotnetRuntimeBootstrapper.AppHost.Cli/DotnetRuntimeBootstrapper.AppHost.Cli.csproj b/DotnetRuntimeBootstrapper.AppHost.Cli/DotnetRuntimeBootstrapper.AppHost.Cli.csproj index a9ad30f..7005b69 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Cli/DotnetRuntimeBootstrapper.AppHost.Cli.csproj +++ b/DotnetRuntimeBootstrapper.AppHost.Cli/DotnetRuntimeBootstrapper.AppHost.Cli.csproj @@ -12,7 +12,7 @@ - + diff --git a/DotnetRuntimeBootstrapper.AppHost.Core/BootstrapperBase.cs b/DotnetRuntimeBootstrapper.AppHost.Core/BootstrapperBase.cs index a88d7df..ee8f508 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Core/BootstrapperBase.cs +++ b/DotnetRuntimeBootstrapper.AppHost.Core/BootstrapperBase.cs @@ -55,8 +55,7 @@ private void HandleException(Exception exception) var bootstrapperVersion = Assembly .GetExecutingAssembly() .GetName() - .Version - .ToString(3); + .Version.ToString(3); var content = $""" Description: Bootstrapper for a .NET application has failed. diff --git a/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs b/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs index 2e04b4c..a9cd3b1 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs +++ b/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs @@ -9,18 +9,16 @@ internal static class DotnetInstallation { private static string? TryGetDirectoryPathFromRegistry() { - var dotnetRegistryKey = Registry - .LocalMachine - .OpenSubKey( - ( - OperatingSystemEx.ProcessorArchitecture.Is64Bit() - ? "SOFTWARE\\Wow6432Node\\" - : "SOFTWARE\\" - ) - + "dotnet\\Setup\\InstalledVersions\\" - + OperatingSystemEx.ProcessorArchitecture.GetMoniker(), - false - ); + var dotnetRegistryKey = Registry.LocalMachine.OpenSubKey( + ( + OperatingSystemEx.ProcessorArchitecture.Is64Bit() + ? "SOFTWARE\\Wow6432Node\\" + : "SOFTWARE\\" + ) + + "dotnet\\Setup\\InstalledVersions\\" + + OperatingSystemEx.ProcessorArchitecture.GetMoniker(), + false + ); var dotnetDirPath = dotnetRegistryKey?.GetValue("InstallLocation", null) as string; diff --git a/DotnetRuntimeBootstrapper.AppHost.Core/DotnetRuntimeBootstrapper.AppHost.Core.csproj b/DotnetRuntimeBootstrapper.AppHost.Core/DotnetRuntimeBootstrapper.AppHost.Core.csproj index e7c84fb..4d429c5 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Core/DotnetRuntimeBootstrapper.AppHost.Core.csproj +++ b/DotnetRuntimeBootstrapper.AppHost.Core/DotnetRuntimeBootstrapper.AppHost.Core.csproj @@ -5,7 +5,7 @@ - + diff --git a/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs b/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs index 70e1ede..690552b 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs +++ b/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs @@ -11,17 +11,15 @@ internal class VisualCppPrerequisite : IPrerequisite public string DisplayName => "Visual C++ Redistributable 2015-2019"; public bool IsInstalled() => - Registry - .LocalMachine - .ContainsSubKey( - ( - OperatingSystemEx.ProcessorArchitecture.Is64Bit() - ? "SOFTWARE\\Wow6432Node\\" - : "SOFTWARE\\" - ) - + "Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\" - + OperatingSystemEx.ProcessorArchitecture.GetMoniker() - ); + Registry.LocalMachine.ContainsSubKey( + ( + OperatingSystemEx.ProcessorArchitecture.Is64Bit() + ? "SOFTWARE\\Wow6432Node\\" + : "SOFTWARE\\" + ) + + "Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\" + + OperatingSystemEx.ProcessorArchitecture.GetMoniker() + ); public IPrerequisiteInstaller DownloadInstaller(Action? handleProgress) { diff --git a/DotnetRuntimeBootstrapper.AppHost.Gui/DotnetRuntimeBootstrapper.AppHost.Gui.csproj b/DotnetRuntimeBootstrapper.AppHost.Gui/DotnetRuntimeBootstrapper.AppHost.Gui.csproj index f8d689f..f06e49e 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Gui/DotnetRuntimeBootstrapper.AppHost.Gui.csproj +++ b/DotnetRuntimeBootstrapper.AppHost.Gui/DotnetRuntimeBootstrapper.AppHost.Gui.csproj @@ -13,7 +13,7 @@ - + diff --git a/DotnetRuntimeBootstrapper.Demo.Cli/DotnetRuntimeBootstrapper.Demo.Cli.csproj b/DotnetRuntimeBootstrapper.Demo.Cli/DotnetRuntimeBootstrapper.Demo.Cli.csproj index e3984df..0adf7ce 100644 --- a/DotnetRuntimeBootstrapper.Demo.Cli/DotnetRuntimeBootstrapper.Demo.Cli.csproj +++ b/DotnetRuntimeBootstrapper.Demo.Cli/DotnetRuntimeBootstrapper.Demo.Cli.csproj @@ -14,7 +14,7 @@ - + diff --git a/DotnetRuntimeBootstrapper.Demo.Gui/DotnetRuntimeBootstrapper.Demo.Gui.csproj b/DotnetRuntimeBootstrapper.Demo.Gui/DotnetRuntimeBootstrapper.Demo.Gui.csproj index 321cac1..36cec0c 100644 --- a/DotnetRuntimeBootstrapper.Demo.Gui/DotnetRuntimeBootstrapper.Demo.Gui.csproj +++ b/DotnetRuntimeBootstrapper.Demo.Gui/DotnetRuntimeBootstrapper.Demo.Gui.csproj @@ -16,7 +16,7 @@ - + diff --git a/DotnetRuntimeBootstrapper/BootstrapperTask.cs b/DotnetRuntimeBootstrapper/BootstrapperTask.cs index 00d10b2..e1b4d83 100644 --- a/DotnetRuntimeBootstrapper/BootstrapperTask.cs +++ b/DotnetRuntimeBootstrapper/BootstrapperTask.cs @@ -72,28 +72,22 @@ private void InjectConfiguration() new ReaderParameters { ReadWrite = true } ); - assembly - .MainModule - .Resources - .RemoveAll( - r => - string.Equals( - r.Name, - "BootstrapperConfiguration", - StringComparison.OrdinalIgnoreCase - ) - ); - - assembly - .MainModule - .Resources - .Add( - new EmbeddedResource( + assembly.MainModule.Resources.RemoveAll( + r => + string.Equals( + r.Name, "BootstrapperConfiguration", - ManifestResourceAttributes.Public, - Encoding.UTF8.GetBytes(configuration) + StringComparison.OrdinalIgnoreCase ) - ); + ); + + assembly.MainModule.Resources.Add( + new EmbeddedResource( + "BootstrapperConfiguration", + ManifestResourceAttributes.Public, + Encoding.UTF8.GetBytes(configuration) + ) + ); assembly.Write(); diff --git a/DotnetRuntimeBootstrapper/DotnetRuntimeBootstrapper.csproj b/DotnetRuntimeBootstrapper/DotnetRuntimeBootstrapper.csproj index dd62e76..dbdf4ef 100644 --- a/DotnetRuntimeBootstrapper/DotnetRuntimeBootstrapper.csproj +++ b/DotnetRuntimeBootstrapper/DotnetRuntimeBootstrapper.csproj @@ -27,7 +27,7 @@ - +