Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix upgrade issue by removing legacy Views assembly #4068

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Oqtane.Server/Infrastructure/UpgradeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;

namespace Oqtane.Infrastructure
{
Expand Down Expand Up @@ -365,7 +366,24 @@ private void Upgrade_5_1_0(Tenant tenant, IServiceScope scope)
{
_configManager.AddOrUpdateSetting("RenderMode", rendermode.Replace("Prerendered", ""), true);
}

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
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);
filepath = Path.Combine(binFolder, "Oqtane.Server.Views.pdb");
if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath);
}
catch (Exception ex)
{
// error deleting file
Debug.WriteLine($"Oqtane Error: Error In 5.1.0 Upgrade Logic - {ex}");
}
}

}
}
}