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 | 48 +++++++++++-------- Oqtane.Server/Oqtane.Server.csproj | 1 - 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/Oqtane.Package/Oqtane.Client.nuspec b/Oqtane.Package/Oqtane.Client.nuspec index 4c346c87..2424b8f7 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 8c6be30a..71e9dcd8 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 0d26600b..1307b57f 100644 --- a/Oqtane.Server/Infrastructure/InstallationManager.cs +++ b/Oqtane.Server/Infrastructure/InstallationManager.cs @@ -137,16 +137,20 @@ namespace Oqtane.Infrastructure // 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,22 +259,26 @@ namespace Oqtane.Infrastructure // 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))) + { + if (assemblies[Path.GetFileName(filepath)] == 1) + { + DeleteFile(filepath); + assemblies.Remove(Path.GetFileName(filepath)); + } + else + { + assemblies[Path.GetFileName(filepath)] -= 1; + } + } + else // does not exist in assembly log { DeleteFile(filepath); - assemblies.Remove(Path.GetFileName(filepath)); } - else - { - assemblies[Path.GetFileName(filepath)] -= 1; - } - } - 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 c91148db..65492794 100644 --- a/Oqtane.Server/Oqtane.Server.csproj +++ b/Oqtane.Server/Oqtane.Server.csproj @@ -47,7 +47,6 @@ -