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

Added logic to ensure assembly version being installed is equal to or greater than existing assembly #3036

Merged
merged 1 commit into from Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion Oqtane.Server/Infrastructure/InstallationManager.cs
Expand Up @@ -201,7 +201,24 @@ private static string ExtractFile(ZipArchiveEntry entry, string folder, int igno
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
entry.ExtractToFile(filename, true);
if (Path.Exists(filename) && Path.GetExtension(filename).ToLower() == ".dll")
{
// ensure assembly version is equal to or greater than existing assembly
var assembly = filename.Replace(Path.GetFileName(filename), "temp.dll");
entry.ExtractToFile(assembly, true);
if (Version.Parse(FileVersionInfo.GetVersionInfo(assembly).FileVersion).CompareTo(Version.Parse(FileVersionInfo.GetVersionInfo(filename).FileVersion)) >= 0)
{
File.Move(assembly, filename, true);
}
else
{
File.Delete(assembly);
}
}
else
{
entry.ExtractToFile(filename, true);
}
}
catch
{
Expand Down