Provide an easy way to add additional module paths to PSModulePath via settings
See original GitHub issueSome projects might benefit from an easy way to add paths to their PowerShell session’s PSModulePath so that modules in non-standard paths are available for IntelliSense and parse-time checks.
One specific use case is developing multiple DSC resources in the same folder structure. You will get parse-time errors about missing DSC resources if your the other resources you’re developing cannot be found in the PSModulePath.
It’s fairly easy to change your Microsoft.VSCode_profile.ps1 to add your workspace path to $env:PSModulePath
but that setting will not transfer to other developers in the project. If this was a workspace-level setting, it could be enabled for anyone who opens the code in VS Code.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:7 (2 by maintainers)
Top Results From Across the Web
about PSModulePath - PowerShell | Microsoft Learn
Modifying PSModulePath in Windows The following example adds the C:\Program Files\Fabrikam\Modules path to the value of the PSModulePath ...
Read more >PowerShell Add a Persistent Module Path to $env ... - Tom Talks
Often you might want to add an additional persistent path to check for modules to auto load. This information is actually held in...
Read more >Everything you wanted to know about PowerShell's Module ...
The PSModulePath environment variable stores the paths to the locations of the modules that are installed on disk. PowerShell uses this variable ...
Read more >Set PSModulePath Environment Variable with PowerShell in ...
"C:\Users\Username\Documents\WindowsPowerShell\Modules" - This would only exist in the user's PATH variable. It appears you are modifying the ...
Read more >How to Install PowerShell Modules: A Step by Step Guide
This helps ensure that the new module is installed in a path listed in the PSModulePath environment variable. You can determine where to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep, exactly what I’m thinking, the setting would be a list of paths that defaults to just
${workspaceRoot}
. And the nice thing is that I’m already adjusting the PSModulePath to add the “bundledModulesPath” so this would just be a generalization of what I’m doing already 😃Pretty sure we already add the bundled modules path to
PSModulePath
, so it could probably be added there.It’s worth noting though, this could also cause some unintended code execution. If a workspace adds a
PSModulePath
with a module that exports a function for every letter (i.e. one function called a, one called b, etc) then typing anything in the editor pane will cause thepsm1
to be invoked.A lot less problematic than workspace profiles, but still something to consider.