From 2b12b675825f44110a1539755eac38b376b69eec Mon Sep 17 00:00:00 2001 From: sbwalker Date: Fri, 19 Jan 2024 13:22:38 -0500 Subject: [PATCH] do not include Licensing assembly with framework but prevent uninstall --- Oqtane.Package/Oqtane.Client.nuspec | 1 - Oqtane.Package/Oqtane.Shared.nuspec | 1 - .../Infrastructure/InstallationManager.cs | 46 +++++++++++-------- Oqtane.Server/Oqtane.Server.csproj | 1 - 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Oqtane.Package/Oqtane.Client.nuspec b/Oqtane.Package/Oqtane.Client.nuspec index 4c346c874..2424b8f74 100644 --- a/Oqtane.Package/Oqtane.Client.nuspec +++ b/Oqtane.Package/Oqtane.Client.nuspec @@ -19,7 +19,6 @@ - \ No newline at end of file diff --git a/Oqtane.Package/Oqtane.Shared.nuspec b/Oqtane.Package/Oqtane.Shared.nuspec index 8c6be30ad..71e9dcd88 100644 --- a/Oqtane.Package/Oqtane.Shared.nuspec +++ b/Oqtane.Package/Oqtane.Shared.nuspec @@ -19,7 +19,6 @@ - \ No newline at end of file diff --git a/Oqtane.Server/Infrastructure/InstallationManager.cs b/Oqtane.Server/Infrastructure/InstallationManager.cs index 0d26600b9..1307b57f5 100644 --- a/Oqtane.Server/Infrastructure/InstallationManager.cs +++ b/Oqtane.Server/Infrastructure/InstallationManager.cs @@ -137,16 +137,20 @@ public static string InstallPackages(string webRootPath, string contentRootPath) // register assembly if (Path.GetExtension(filename) == ".dll") { - // if package version was not installed previously - if (!File.Exists(Path.Combine(sourceFolder, name + ".log"))) + // do not register licensing assemblies + if (!Path.GetFileName(filename).StartsWith("Oqtane.Licensing.")) { - if (assemblies.ContainsKey(Path.GetFileName(filename))) + // if package version was not installed previously + if (!File.Exists(Path.Combine(sourceFolder, name + ".log"))) { - assemblies[Path.GetFileName(filename)] += 1; - } - else - { - assemblies.Add(Path.GetFileName(filename), 1); + if (assemblies.ContainsKey(Path.GetFileName(filename))) + { + assemblies[Path.GetFileName(filename)] += 1; + } + else + { + assemblies.Add(Path.GetFileName(filename), 1); + } } } } @@ -255,23 +259,27 @@ public bool UninstallPackage(string PackageName) // delete assets if (Path.GetExtension(filepath) == ".dll") { - // use assembly log to determine if assembly is used in other packages - if (assemblies.ContainsKey(Path.GetFileName(filepath))) + // do not remove licensing assemblies + if (!Path.GetFileName(filepath).StartsWith("Oqtane.Licensing.")) { - if (assemblies[Path.GetFileName(filepath)] == 1) + // use assembly log to determine if assembly is used in other packages + if (assemblies.ContainsKey(Path.GetFileName(filepath))) { - DeleteFile(filepath); - assemblies.Remove(Path.GetFileName(filepath)); + if (assemblies[Path.GetFileName(filepath)] == 1) + { + DeleteFile(filepath); + assemblies.Remove(Path.GetFileName(filepath)); + } + else + { + assemblies[Path.GetFileName(filepath)] -= 1; + } } - else + else // does not exist in assembly log { - assemblies[Path.GetFileName(filepath)] -= 1; + DeleteFile(filepath); } } - else // does not exist in assembly log - { - DeleteFile(filepath); - } } else // not an assembly { diff --git a/Oqtane.Server/Oqtane.Server.csproj b/Oqtane.Server/Oqtane.Server.csproj index c91148db6..654927941 100644 --- a/Oqtane.Server/Oqtane.Server.csproj +++ b/Oqtane.Server/Oqtane.Server.csproj @@ -47,7 +47,6 @@ -