mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 10:58:28 +00:00
fix: match main assembly by PackageId metadata instead of AssemblyName
This commit is contained in:
parent
1e63b10aa4
commit
c323c872fc
1 changed files with 8 additions and 7 deletions
|
|
@ -77,14 +77,15 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
|
|
||||||
essentials.Version = Global.AssemblyVersion;
|
essentials.Version = Global.AssemblyVersion;
|
||||||
|
|
||||||
// The main program assembly (AssemblyName/PackageId "PepperDashEssentials") is what's
|
// The main program assembly (PackageId "PepperDashEssentials") is what's actually published
|
||||||
// actually published to NuGet, but this handler lives in PepperDash.Essentials.Core, which
|
// to NuGet, but this handler lives in PepperDash.Essentials.Core, which can't reference that
|
||||||
// can't reference that project's types directly (Essentials -> Core, not the reverse).
|
// project's types directly (Essentials -> Core, not the reverse). PluginLoader.EssentialsAssembly.Assembly
|
||||||
// PluginLoader.EssentialsAssembly.Assembly is unreliable (often left null - see
|
// is unreliable (often left null - see PluginLoader.SetEssentialsAssembly), so look it up
|
||||||
// PluginLoader.SetEssentialsAssembly), so look it up directly from the loaded AppDomain,
|
// directly from the loaded AppDomain by its Directory.Build.props-embedded PackageId metadata
|
||||||
// falling back to this handler's own (Core) assembly if it can't be found.
|
// (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()
|
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;
|
?? typeof(GetPackageManifestRequestHandler).Assembly;
|
||||||
|
|
||||||
var repoUrl = TrimTrailingGit(GetAssemblyMetadataValue(essentialsAssembly, "RepositoryUrl"));
|
var repoUrl = TrimTrailingGit(GetAssemblyMetadataValue(essentialsAssembly, "RepositoryUrl"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue