简体   繁体   中英

PowerShell: Visual Studio Code - changes in modules are not reflected

I am using Visual Studio Code with PowerShell plugin for editing and debuging PowerShell scripts. As my script got too large to handle I have extraced some parts into several psm1 modules. All the files resides in the same direcory - root of the VSC workspace.

If I run the script for the first time using Ctrl+F5 all the files are compiled and the script is executed. But if I then make any modifications in the imported module files (*.psm1) these changes are not reflected and the old versions of the modules are used instead.

The only thing that helps is closing and reopening VSC. How can I configure VSC in order to rebuild/recompile changed (or all) modules in my workspace before run/debug?

Based on Mathias comment I have found that adding -force option to Import-Module helps.

It look like being an issue of PowerShell rather than VS Code.

https://github.com/PowerShell/PowerShell/issues/2505

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM