Better resolution of file system modules in Get-Module – Chapter 3 - #27853
Draft
Guillermo López-Anglada (guillermooo) wants to merge 117 commits into
Draft
Conversation
The point is to return a fully qualified path, which cannot be the case if `relativeTo` is `null` and we need to use it.
The comment may not apply to newer versions of .NET.
Relative-rooted paths such as: .\foo.psm1 ..\foo.psm1 and home-rooted paths such as: ~\foo.psm1 are now fully resolved via $executionContext.SessionState.Path.GetResolvedProviderPathFromPSPath() instead of joining them with the working directory first, because GetResolvedProviderPathFromPSPath() already joins relative paths with the working directory as needed. Before this commit, ~\foo.psm1 was resolved to $pwd\~\foo.psm1. After this commit, ~\foo.psm1 correctly resolves to $HOME\foo.psm1. A path like .\~\foo.psm1 still resolves to $pwd\~\foo.psm1.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This was referenced Aug 14, 2026
Get-Module – Chapter 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Correctly resolve home-rooted module paths both with
Get-Module -NameandGet-Module -FullyQualifiedName.Important
Change approved by WG recommendation.
Warning
This is a breaking change. The output of
Get-Moduleis now different for home-rooted paths such as~/foo.psm1.PR Context
Get-Module -ListAvailable -FullyQualifiedNamemodule resolution feels inconsistent #27716This is the full series of changes:
Get-Module– Chapter 1 #27847Get-Module– Chapter 2 #27848Get-Module– Chapter 3 #27853PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header