You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PackageManagment binaries should be installed under \Modules\PackageManagement\ folder #2347
It is observed that PowerShell core is loading assembles from its installed folder first (e.g. PowerShell\6.0.0.10) if exists, even if ipmo with a full path. For most cases, this behavior seems to be ok. However for the PackageManagement, we need to allow users to update the PackageManagement via install-module. The updated binaries will be installed under PowerShell\6.0.0.10\Modules\PackageManagement. But these updated assemblies won't get loaded because PowerShell loads the built-in PackageManagement assemblies first.
Proposed Solution
When packaging the next alpha release, PackageManagment binaries should be installed under PowerShell\6.0.0.10\Modules\PackageManagement\ folder instead of root PowerShell\6.0.0.10\ folder.
copy any binary , In my case, Microsoft.PackageManagement.dll, to C:\Program Files\PowerShell\6.0.0.10\Modules\PackageManagement
or any folder such as C:\Program Files\PowerShell\6.0.0.10\Temp.
For CoreCLR powershell, Import-Module <path-to-foo.dll> would load the foo.dll from $PSHome if there is one there, which is the described symptom in this issue.
At any rate, if we want any in-box module to be update-able, then it should not leave the original set of assemblies around after it's updated. So PackageManagement assemblies should be placed within the module folder, at least when we package and release powershell core.
can you help me understand why this is OneGet issue? If PowerShellCore can not change the behavior by loading the binaries from root, even if a user explicitly ask from other folder, "ipmo C:\Program Files\PowerShell\6.0.0.10\Modules\PackageManagement\Microsoft.PackageManagement.dll" for example, then at least should package them to Modules folder so modules are updatable. In this case, put them under \Modules\PackageManagement folder. Reopen it.
This seems to have been resolved in 6.0.0.13 with the binaries for PackageManagement being located correctly in C:\Program Files\PowerShell\6.0.0.13\Modules\PackageManagement\1.1.1.0\coreclr
Activity
kilasuit commentedon Sep 23, 2016
This looks like it is the same for the other modules that are installed with v6.0.0.10 too so would need to be resolved for them as well.
daxian-dbw commentedon Sep 23, 2016
This happens because when running
Import-Module <path-to-foo.dll>, powershell first tries to load the assembly using its short namefooviaAssembly.Load, and if that fails, it turns toLoadFromwith the file path (https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/ExecutionContext.cs#L1376).Therefore, for FullCLR powershell,
Import-Module <path-to-foo.dll>would load the GAC'edfoo.dllif there is one:For CoreCLR powershell,
Import-Module <path-to-foo.dll>would load thefoo.dllfrom$PSHomeif there is one there, which is the described symptom in this issue.daxian-dbw commentedon Sep 23, 2016
At any rate, if we want any in-box module to be update-able, then it should not leave the original set of assemblies around after it's updated. So
PackageManagementassemblies should be placed within the module folder, at least when we package and release powershell core.kilasuit commentedon Sep 24, 2016
see #2350 which also has this similar issue and would correct this too
HemantMahawar commentedon Oct 28, 2016
This issue was moved to PowerShell/PowerShellGet#41
jianyunt commentedon Oct 28, 2016
can you help me understand why this is OneGet issue? If PowerShellCore can not change the behavior by loading the binaries from root, even if a user explicitly ask from other folder, "ipmo C:\Program Files\PowerShell\6.0.0.10\Modules\PackageManagement\Microsoft.PackageManagement.dll" for example, then at least should package them to Modules folder so modules are updatable. In this case, put them under \Modules\PackageManagement folder. Reopen it.
kilasuit commentedon Dec 1, 2016
This seems to have been resolved in 6.0.0.13 with the binaries for PackageManagement being located correctly in
C:\Program Files\PowerShell\6.0.0.13\Modules\PackageManagement\1.1.1.0\coreclrHemantMahawar commentedon Dec 6, 2016
Ryan Yates (@kilasuit) Thanks for the confirmation.