Skip to content

Commit 684d0b8

Browse files
🩹 [Patch]: Fix removal of loaded module to get a clean slate (#81)
## Description - Fix removal of loaded module to get a clean slate ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 91f9e06 commit 684d0b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/helpers/Build/Import-PSModule.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
Write-Verbose "Manifest file path: [$($manifestFile.FullName)]" -Verbose
3131
$existingModule = Get-Module -Name $ModuleName -ListAvailable
3232
$existingModule | Remove-Module -Force -Verbose
33-
$existingModule.RequiredModules | ForEach-Object { Remove-Module -Name $_ -Force -Verbose }
34-
$existingModule.NestedModules | ForEach-Object { Remove-Module -Name $_ -Force -Verbose }
33+
$existingModule.RequiredModules | ForEach-Object { Remove-Module -Name $_ -Force -Verbose -ErrorAction SilentlyContinue }
34+
$existingModule.NestedModules | ForEach-Object { Remove-Module -Name $_ -Force -Verbose -ErrorAction SilentlyContinue }
3535
# Get-InstalledPSResource | Where-Object Name -EQ $ModuleName | Uninstall-PSResource -SkipDependencyCheck -Verbose:$false
3636
Resolve-PSModuleDependencies -ManifestFilePath $manifestFile
3737
Import-Module -Name $ModuleName -RequiredVersion '999.0.0'

0 commit comments

Comments
 (0)