diff --git a/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs b/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs index 7311630c3..671075bbc 100644 --- a/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs +++ b/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs @@ -103,7 +103,13 @@ protected override void Configure() Logger = Log.Logger = logConfig.CreateLogger(); - Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation); +#if FORCE_CHOCOLATEY_OFFICIAL_KEY + var chocolateyGuiPublicKey = OfficialChocolateyGuiPublicKey; +#else + var chocolateyGuiPublicKey = UnofficialChocolateyGuiPublicKey; +#endif + + Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation, chocolateyGuiPublicKey); } protected override async void OnStartup(object sender, StartupEventArgs e) diff --git a/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs b/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs index ef7bd02f4..616061d0b 100644 --- a/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs +++ b/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs @@ -20,7 +20,7 @@ public static class AutoFacConfiguration "Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "This is really a requirement due to required registrations.")] - public static IContainer RegisterAutoFac(string chocolateyGuiAssemblySimpleName, string licensedGuiAssemblyLocation) + public static IContainer RegisterAutoFac(string chocolateyGuiAssemblySimpleName, string licensedGuiAssemblyLocation, string publicKey) { var builder = new ContainerBuilder(); builder.RegisterAssemblyModules(System.Reflection.Assembly.GetCallingAssembly()); @@ -32,7 +32,7 @@ public static IContainer RegisterAutoFac(string chocolateyGuiAssemblySimpleName, { var licensedGuiAssembly = AssemblyResolution.resolve_or_load_assembly( chocolateyGuiAssemblySimpleName, - chocolatey.infrastructure.app.ApplicationParameters.OfficialChocolateyPublicKey, + publicKey, licensedGuiAssemblyLocation); if (licensedGuiAssembly != null) diff --git a/Source/ChocolateyGuiCli/Bootstrapper.cs b/Source/ChocolateyGuiCli/Bootstrapper.cs index 9b4fe0932..180b0daf0 100644 --- a/Source/ChocolateyGuiCli/Bootstrapper.cs +++ b/Source/ChocolateyGuiCli/Bootstrapper.cs @@ -72,7 +72,13 @@ internal static void Configure() Logger = Log.Logger = logConfig.CreateLogger(); - Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation); +#if FORCE_CHOCOLATEY_OFFICIAL_KEY + var chocolateyGuiPublicKey = OfficialChocolateyGuiPublicKey; +#else + var chocolateyGuiPublicKey = UnofficialChocolateyGuiPublicKey; +#endif + + Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation, chocolateyGuiPublicKey); } } } \ No newline at end of file