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

[ContextMenus]Update win11 msix menus if wrong version #37289

Merged
merged 2 commits into from
Feb 9, 2025
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
8 changes: 7 additions & 1 deletion src/common/utils/package.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <winrt/Windows.Management.Deployment.h>

#include "../logger/logger.h"
#include "../version/version.h"

namespace package {
inline BOOL IsWin11OrGreater()
Expand Down Expand Up @@ -47,10 +48,14 @@ namespace package {
for (auto const& package : packageManager.FindPackagesForUser({}))
{
const auto& packageFullName = std::wstring{ package.Id().FullName() };
const auto& packageVersion = package.Id().Version();

if (packageFullName.contains(packageDisplayName))
{
return true;
if (packageVersion.Major == VERSION_MAJOR && packageVersion.Minor == VERSION_MINOR && packageVersion.Revision == VERSION_REVISION)
{
return true;
}
}
}

Expand All @@ -72,6 +77,7 @@ namespace package {
// Declare use of an external location
AddPackageOptions options;
options.ExternalLocationUri(externalUri);
options.ForceUpdateFromAnyVersion(true);

IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> deploymentOperation = packageManager.AddPackageByUriAsync(packageUri, options);
deploymentOperation.get();
Expand Down
Loading