Skip to content

Commit

Permalink
Only install Microsoft.WinGet.Client module if not already installed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que authored Nov 18, 2024
1 parent 203b8d4 commit f06cc36
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ await _processExecutor.ExecuteAsync(
_logger.LogInformation("Ensuring Git is up-to-date...");
var script =
"""
Install-Module -Name Microsoft.WinGet.Client -Force;
if ($null -eq (Get-InstalledModule -ErrorAction SilentlyContinue -Name Microsoft.WinGet.Client)) {
Install-Module -Name Microsoft.WinGet.Client -Force;
}
Install-WinGetPackage -Id Microsoft.Git -Mode Silent;
""";
var encodedScript = Convert.ToBase64String(Encoding.Unicode.GetBytes(script));
Expand Down

0 comments on commit f06cc36

Please sign in to comment.