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

Allow higher versions to satisfy the VCLibs dependency in Repair #3763

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Microsoft.WinGet.Client.Engine.Helpers
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand Down Expand Up @@ -254,15 +255,28 @@ private void InstallVCLibsDependencies()
{ Name, VCLibsUWPDesktop },
});

// See if the required version is installed.
// See if the minimum (or greater) version is installed.
// TODO: Pull the minimum version from the target package
// TODO: This does not check architecture of the package
Version minimumVersion = new Version(VCLibsUWPDesktopVersion);

bool isInstalled = false;
if (result != null &&
result.Count > 0)
{
foreach (dynamic psobject in result)
{
if (psobject?.Version == VCLibsUWPDesktopVersion)
string versionString = psobject?.Version?.ToString();
if (versionString == null)
{
continue;
}

Version packageVersion = new Version(versionString);

if (packageVersion >= minimumVersion)
{
this.psCmdlet.WriteDebug($"VCLibs dependency satisfied by: {psobject?.PackageFullName ?? "<null>"}");
isInstalled = true;
break;
}
Expand Down
12 changes: 6 additions & 6 deletions src/PowerShell/scripts/Initialize-LocalWinGetModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ if ($BuildRoot -eq "")
$BuildRoot = "$PSScriptRoot\..\..";
}

# Add here new modules
# Modules, they should be in dependency order so that when importing we don't pick up the release modules.
[WinGetModule[]]$local:modules =
[WinGetModule]::new(
"Microsoft.WinGet.DSC",
"$PSScriptRoot\..\Microsoft.WinGet.DSC\",
$false),
[WinGetModule]::new(
"Microsoft.WinGet.Client",
"$PSScriptRoot\..\Microsoft.WinGet.Client\ModuleFiles\",
$true),
[WinGetModule]::new(
"Microsoft.WinGet.DSC",
"$PSScriptRoot\..\Microsoft.WinGet.DSC\",
$false),
[WinGetModule]::new(
"Microsoft.WinGet.Configuration",
"$PSScriptRoot\..\Microsoft.WinGet.Configuration\ModuleFiles\",
Expand Down Expand Up @@ -111,6 +111,6 @@ if (-not $SkipImportModule)
foreach($module in $modules)
{
Write-Host "Importing module $($module.Name)" -ForegroundColor Green
Import-Module $module.Name -Force
Import-Module "$moduleRootOutput\$($module.Name)\" -Force
}
}