From f06cc36f30ffb974e2f795868e8bb24ed33a63d3 Mon Sep 17 00:00:00 2001 From: June Rhodes Date: Mon, 18 Nov 2024 11:49:43 +1100 Subject: [PATCH] Only install Microsoft.WinGet.Client module if not already installed (#53) --- .../PhysicalGit/DefaultPhysicalGitCheckout.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UET/Redpoint.Uet.Workspace/PhysicalGit/DefaultPhysicalGitCheckout.cs b/UET/Redpoint.Uet.Workspace/PhysicalGit/DefaultPhysicalGitCheckout.cs index b7f86915..b21ab2b7 100644 --- a/UET/Redpoint.Uet.Workspace/PhysicalGit/DefaultPhysicalGitCheckout.cs +++ b/UET/Redpoint.Uet.Workspace/PhysicalGit/DefaultPhysicalGitCheckout.cs @@ -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));