fix #4848 - remove assemblies from /bin which have been moved to /bin/refs in .NET 9

This commit is contained in:
sbwalker 2024-11-22 12:13:45 -05:00
parent 7d94e4a53a
commit 3528b8c674
2 changed files with 54 additions and 3 deletions

View File

@ -69,6 +69,9 @@ namespace Oqtane.Infrastructure
case "5.2.1":
Upgrade_5_2_1(tenant, scope);
break;
case "6.0.1":
Upgrade_6_0_1(tenant, scope);
break;
}
}
}
@ -371,7 +374,7 @@ namespace Oqtane.Infrastructure
try
{
// delete legacy Views assemblies which will cause startup errors due to missing HostModel
// note that the following files will be deleted however the framework has already started up so a restart will be required
// note that the following files will be deleted however the framework has already started up so another restart will be required
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var filepath = Path.Combine(binFolder, "Oqtane.Server.Views.dll");
if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath);
@ -441,6 +444,54 @@ namespace Oqtane.Infrastructure
AddPagesToSites(scope, tenant, pageTemplates);
}
private void Upgrade_6_0_1(Tenant tenant, IServiceScope scope)
{
// assemblies which have been relocated to the bin/refs folder in .NET 9
string[] assemblies = {
"Microsoft.AspNetCore.Authorization.dll",
"Microsoft.AspNetCore.Components.Authorization.dll",
"Microsoft.AspNetCore.Components.dll",
"Microsoft.AspNetCore.Components.Forms.dll",
"Microsoft.AspNetCore.Components.Web.dll",
"Microsoft.AspNetCore.Cryptography.Internal.dll",
"Microsoft.AspNetCore.Cryptography.KeyDerivation.dll",
"Microsoft.AspNetCore.Metadata.dll",
"Microsoft.Extensions.Caching.Memory.dll",
"Microsoft.Extensions.Configuration.Binder.dll",
"Microsoft.Extensions.Configuration.FileExtensions.dll",
"Microsoft.Extensions.Configuration.Json.dll",
"Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"Microsoft.Extensions.DependencyInjection.dll",
"Microsoft.Extensions.Diagnostics.Abstractions.dll",
"Microsoft.Extensions.Diagnostics.dll",
"Microsoft.Extensions.Http.dll",
"Microsoft.Extensions.Identity.Core.dll",
"Microsoft.Extensions.Identity.Stores.dll",
"Microsoft.Extensions.Localization.Abstractions.dll",
"Microsoft.Extensions.Localization.dll",
"Microsoft.Extensions.Logging.Abstractions.dll",
"Microsoft.Extensions.Logging.dll",
"Microsoft.Extensions.Options.dll",
"Microsoft.JSInterop.dll",
"System.Text.Json.dll"
};
foreach (var assembly in assemblies)
{
try
{
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var filepath = Path.Combine(binFolder, assembly);
if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath);
}
catch (Exception ex)
{
// error deleting asesmbly
Debug.WriteLine($"Oqtane Error: 6.0.1 Upgrade Error Removing {assembly} - {ex}");
}
}
}
private void AddPagesToSites(IServiceScope scope, Tenant tenant, List<PageTemplate> pageTemplates)
{
var tenants = scope.ServiceProvider.GetRequiredService<ITenantManager>();

View File

@ -4,8 +4,8 @@ namespace Oqtane.Shared
{
public class Constants
{
public static readonly string Version = "6.0.0";
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0,2.2.0,2.3.0,2.3.1,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.1.1,3.1.2,3.1.3,3.1.4,3.2.0,3.2.1,3.3.0,3.3.1,3.4.0,3.4.1,3.4.2,3.4.3,4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5,4.0.6,5.0.0,5.0.1,5.0.2,5.0.3,5.1.0,5.1.1,5.1.2,5.2.0,5.2.1,5.2.2,5.2.3,5.2.4,6.0.0";
public static readonly string Version = "6.0.1";
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0,2.2.0,2.3.0,2.3.1,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.1.1,3.1.2,3.1.3,3.1.4,3.2.0,3.2.1,3.3.0,3.3.1,3.4.0,3.4.1,3.4.2,3.4.3,4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5,4.0.6,5.0.0,5.0.1,5.0.2,5.0.3,5.1.0,5.1.1,5.1.2,5.2.0,5.2.1,5.2.2,5.2.3,5.2.4,6.0.0,6.0.1";
public const string PackageId = "Oqtane.Framework";
public const string ClientId = "Oqtane.Client";
public const string UpdaterPackageId = "Oqtane.Updater";