Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个 Cmdlet 并使用 Powershell-ISE 进行测试。ISE 将我的 DLL 锁定并防止重新构建然后重新加载。
我试过调用 remove ps-snappin,但 DLL 仍然锁定。
正如 Roman 指出的那样,AFAICT 无法做到这一点。这不是 PowerShell ISE 问题,而是 .NET 程序集加载问题,即 .NET 不支持程序集卸载。如果有一种方法可以通过辅助 AppDomain 添加管理单元,然后卸载整个 AppDomain,那就太好了。我不知道有任何这样的尝试在主机中执行此操作。
基思和罗曼是正确的。将 .NET 程序集加载到 AppDomain 后,释放它的唯一方法是关闭 AppDomain。