From 5a5640e12e43a767f0fb10e7246f69bed6a05aca Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:06:16 +0200 Subject: [PATCH] Update NuGet packages --- .../Bootstrapper.cs | 24 ++++++++----- ...tnetRuntimeBootstrapper.AppHost.Cli.csproj | 4 +-- .../Dotnet/DotnetInstallation.cs | 22 ++++++------ ...netRuntimeBootstrapper.AppHost.Core.csproj | 4 +-- .../Prerequisites/VisualCppPrerequisite.cs | 20 ++++++----- ...tnetRuntimeBootstrapper.AppHost.Gui.csproj | 4 +-- .../DotnetRuntimeBootstrapper.Demo.Cli.csproj | 2 +- .../DotnetRuntimeBootstrapper.Demo.Gui.csproj | 2 +- DotnetRuntimeBootstrapper/BootstrapperTask.cs | 34 +++++++++++-------- .../DotnetRuntimeBootstrapper.csproj | 8 ++--- 10 files changed, 70 insertions(+), 54 deletions(-) diff --git a/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs b/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs index 6c0c3d2..6e7eabf 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs +++ b/DotnetRuntimeBootstrapper.AppHost.Cli/Bootstrapper.cs @@ -33,9 +33,11 @@ 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}"); @@ -57,9 +59,11 @@ 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); @@ -151,9 +155,11 @@ 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 32631be..ed8943e 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Cli/DotnetRuntimeBootstrapper.AppHost.Cli.csproj +++ b/DotnetRuntimeBootstrapper.AppHost.Cli/DotnetRuntimeBootstrapper.AppHost.Cli.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs b/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs index 0faeec5..a025ba2 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs +++ b/DotnetRuntimeBootstrapper.AppHost.Core/Dotnet/DotnetInstallation.cs @@ -9,16 +9,18 @@ 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 cf41785..8facb3a 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Core/DotnetRuntimeBootstrapper.AppHost.Core.csproj +++ b/DotnetRuntimeBootstrapper.AppHost.Core/DotnetRuntimeBootstrapper.AppHost.Core.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs b/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs index 690552b..70e1ede 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs +++ b/DotnetRuntimeBootstrapper.AppHost.Core/Prerequisites/VisualCppPrerequisite.cs @@ -11,15 +11,17 @@ 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 c8492a8..602c776 100644 --- a/DotnetRuntimeBootstrapper.AppHost.Gui/DotnetRuntimeBootstrapper.AppHost.Gui.csproj +++ b/DotnetRuntimeBootstrapper.AppHost.Gui/DotnetRuntimeBootstrapper.AppHost.Gui.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/DotnetRuntimeBootstrapper.Demo.Cli/DotnetRuntimeBootstrapper.Demo.Cli.csproj b/DotnetRuntimeBootstrapper.Demo.Cli/DotnetRuntimeBootstrapper.Demo.Cli.csproj index 828eee4..2c3acdb 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 70decfb..bdbb65e 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 e1b4d83..00d10b2 100644 --- a/DotnetRuntimeBootstrapper/BootstrapperTask.cs +++ b/DotnetRuntimeBootstrapper/BootstrapperTask.cs @@ -72,22 +72,28 @@ private void InjectConfiguration() new ReaderParameters { ReadWrite = true } ); - assembly.MainModule.Resources.RemoveAll( - r => - string.Equals( - r.Name, + assembly + .MainModule + .Resources + .RemoveAll( + r => + string.Equals( + r.Name, + "BootstrapperConfiguration", + StringComparison.OrdinalIgnoreCase + ) + ); + + assembly + .MainModule + .Resources + .Add( + new EmbeddedResource( "BootstrapperConfiguration", - StringComparison.OrdinalIgnoreCase + ManifestResourceAttributes.Public, + Encoding.UTF8.GetBytes(configuration) ) - ); - - 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 ed86376..a03bb61 100644 --- a/DotnetRuntimeBootstrapper/DotnetRuntimeBootstrapper.csproj +++ b/DotnetRuntimeBootstrapper/DotnetRuntimeBootstrapper.csproj @@ -27,11 +27,11 @@ - - - + + + - +