mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
fix: report main assembly's PackageId (PepperDashEssentials) in packageManifest API
This commit is contained in:
parent
47e186d8f4
commit
1e63b10aa4
1 changed files with 10 additions and 4 deletions
|
|
@ -77,9 +77,15 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
|
|
||||||
essentials.Version = Global.AssemblyVersion;
|
essentials.Version = Global.AssemblyVersion;
|
||||||
|
|
||||||
// PepperDash_Essentials_Core.dll - same repo/Directory.Build.props as PepperDashEssentials.dll,
|
// The main program assembly (AssemblyName/PackageId "PepperDashEssentials") is what's
|
||||||
// and unlike PluginLoader.EssentialsAssembly, this Assembly reference is never null at runtime.
|
// actually published to NuGet, but this handler lives in PepperDash.Essentials.Core, which
|
||||||
var essentialsAssembly = typeof(GetPackageManifestRequestHandler).Assembly;
|
// 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.
|
||||||
|
var essentialsAssembly = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
.FirstOrDefault(a => string.Equals(a.GetName().Name, "PepperDashEssentials", StringComparison.OrdinalIgnoreCase))
|
||||||
|
?? typeof(GetPackageManifestRequestHandler).Assembly;
|
||||||
|
|
||||||
var repoUrl = TrimTrailingGit(GetAssemblyMetadataValue(essentialsAssembly, "RepositoryUrl"));
|
var repoUrl = TrimTrailingGit(GetAssemblyMetadataValue(essentialsAssembly, "RepositoryUrl"));
|
||||||
if (!string.IsNullOrEmpty(repoUrl))
|
if (!string.IsNullOrEmpty(repoUrl))
|
||||||
|
|
@ -103,7 +109,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(essentials.PackageId))
|
else if (string.IsNullOrEmpty(essentials.PackageId))
|
||||||
{
|
{
|
||||||
essentials.PackageId = "PepperDash.Essentials";
|
essentials.PackageId = "PepperDashEssentials";
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Essentials = essentials;
|
result.Essentials = essentials;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue