Powershell forcing reload for using module
Asked Answered
S

1

7

Is there a way to force PowerShell to reload a module when using module .\MyModule.psm1?

Normally I would use Import-Module .\MyModule.psm1 -Force but since I am using enum and class C# style this won't do; since enum and class are not visible outside the module if I use Import-Module.

I cannot use first Import-Module and then using module as using module must be on first row.

My PSVersion is 5.1.14409.1005

Shortlived answered 19/9, 2018 at 20:9 Comment(0)
R
3

I'm afraid there is currently no solution (as of Windows PowerShell v5.1 / PowerShell Core 7.2), but one is being proposed for PowerShell Core in GitHub issue #7654.

Additionally, as you observe yourself, the linked issue...

includes further links with discussion, uservoice item and comments about difference between PS and PSCore and some more comments about using vs Import-Module language-design wise.

Raoul answered 20/9, 2018 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.