Skip to content

Commit

Permalink
(#310) Check for presence of Location before usage
Browse files Browse the repository at this point in the history
During testing, it was found that the Location property of the Assembly
was an entry string, therefore the cmdlets weren't being loaded.

This commit attempts to address this by first checking the Location
property, and if it is there, use it.  Otherwise, fall back to the
previous direct Import-Module against the $licensedAssembly.

Will schedule a call with Rain to discuss this further once they are
back from holiday.
  • Loading branch information
gep13 committed May 27, 2024
1 parent 3c93860 commit d56db96
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/chocolatey.resources/helpers/chocolateyInstaller.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ if (Test-Path $extensionsPath) {

if ($licensedAssembly) {
# Import-Module -Assembly doesn't work if the parent module is reimported, so force the import by path.
Import-Module $licensedAssembly.Location -Force
if ($licensedAssembly.Location) {
Import-Module $licensedAssembly.Location -Force
} else {
Import-Module $licensedAssembly
}
}
else {
# Fallback: load the extension DLL from the path directly.
Expand Down

0 comments on commit d56db96

Please sign in to comment.