From c323c872fc169c4f0529f7bcae5f9182ac4c8ca1 Mon Sep 17 00:00:00 2001 From: jkdevito Date: Tue, 7 Jul 2026 17:20:22 -0500 Subject: [PATCH] fix: match main assembly by PackageId metadata instead of AssemblyName --- .../GetPackageManifestRequestHandler.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetPackageManifestRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetPackageManifestRequestHandler.cs index f2fac995..c250ff95 100644 --- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetPackageManifestRequestHandler.cs +++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetPackageManifestRequestHandler.cs @@ -77,14 +77,15 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers essentials.Version = Global.AssemblyVersion; - // The main program assembly (AssemblyName/PackageId "PepperDashEssentials") is what's - // actually published to NuGet, but this handler lives in PepperDash.Essentials.Core, which - // can't reference that project's types directly (Essentials -> Core, not the reverse). - // PluginLoader.EssentialsAssembly.Assembly is unreliable (often left null - see - // PluginLoader.SetEssentialsAssembly), so look it up directly from the loaded AppDomain, - // falling back to this handler's own (Core) assembly if it can't be found. + // The main program assembly (PackageId "PepperDashEssentials") is what's actually published + // to NuGet, but this handler lives in PepperDash.Essentials.Core, which can't reference that + // project's types directly (Essentials -> Core, not the reverse). PluginLoader.EssentialsAssembly.Assembly + // is unreliable (often left null - see PluginLoader.SetEssentialsAssembly), so look it up + // directly from the loaded AppDomain by its Directory.Build.props-embedded PackageId metadata + // (every project's .csproj sets its own PackageId explicitly), falling back to this handler's + // own (Core) assembly if it can't be found. var essentialsAssembly = AppDomain.CurrentDomain.GetAssemblies() - .FirstOrDefault(a => string.Equals(a.GetName().Name, "PepperDashEssentials", StringComparison.OrdinalIgnoreCase)) + .FirstOrDefault(a => string.Equals(GetAssemblyMetadataValue(a, "PackageId"), "PepperDashEssentials", StringComparison.OrdinalIgnoreCase)) ?? typeof(GetPackageManifestRequestHandler).Assembly; var repoUrl = TrimTrailingGit(GetAssemblyMetadataValue(essentialsAssembly, "RepositoryUrl"));