ScriptsToProcess is only processed for the first import #6170
Labels
Issue-Discussion
the issue may not have a clear classification yet. The issue may generate an RFC or may be reclassif
Resolution-No Activity
Issue has had no activity for 6 months or more
WG-Cmdlets-Core
cmdlets in the Microsoft.PowerShell.Core module
The scripts named in
ScriptsToProcess
are processed only for the first module that is imported. This has the following implications for SessionStates that need to include the alterations caused byScriptsToProcess
:Import-Module
statement that usually causes changes to the active SessionState does not make those changes if the module named in the statement happens to already be loaded.ScriptsToProcess
. Which one depends on the order the module importing occurs.A workaround for this might be to use
Import-Module -Force
. However, if the module also involves PowerShell classes, then it might run afoul of #2505.Steps to reproduce
ScriptsToProcess.psd1
ScriptsToProcess.psm1
empty file
ScriptsToProcess.ps1
Invoke the following
Expected behavior
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: