PowerShell的卸载模块...完全 [英] Powershell Unload Module... completely
问题描述
我正在调试一个PowerShell项目。我使用导入模块
加载从我的C#DLL中的PS模块,一切工作正常。呼叫取下模块
不完全卸载模块,虽然作为DLL仍处于锁定状态,不能被删除。
I'm working on debugging a Powershell project. I'm using Import-Module
to load the PS module from my C# dll and everything works fine. Calling Remove-Module
does not fully unload the module though as the DLL is still locked and can not be deleted.
有没有办法让PSH完全卸载模块并释放DLL,这样我可以复制它,并重新加载它再次使用导入模块
无需重新启动PSH控制台?
Is there a way to get PSH to fully unload the module and release the DLL so that I can copy over it and reload it again using Import-Module
without restarting the PSH console?
更新
所以,如果你加载一个模块到一个单独的AppDomain它仍然像一个正常的模块?任何人都可以提供一个例子吗?
Update
So if you load a module into a seperate AppDomain does it still work like a normal module? Can anyone provide an example?
推荐答案
没有。由于PowerShell使用.NET下有相同的要求。 你不能卸载从.NET应用程序域一个dll不卸载应用程序域本身。作为用户界面的PowerShell住在同一应用程序域,这是不可能的。
No. As PowerShell uses .NET underneath it has the same requirements. You cannot unload a dll from a .NET AppDomain without unloading the AppDomain itself. As the PowerShell UI lives in the same AppDomain this is not possible.
这篇关于PowerShell的卸载模块...完全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!