使用 PowerShell 查看全局程序集缓存 (GAC) 的内容
有没有办法使用PowerShell查看GAC的内容?
Is there a way to use PowerShell to view the contents of the GAC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有没有办法使用PowerShell查看GAC的内容?
Is there a way to use PowerShell to view the contents of the GAC?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
我也有同样的问题。 随着 .Net 4.0 的出现,这个问题变得更加突出,并且没有可用于查看内容的 Windows 资源管理器 shell 插件。 GacUtil 可以工作,但不够灵活,安装起来需要花费很多时间。 PowerShell 社区扩展选项的功能有限,并且包含许多我不需要的其他 CmdLet。 因此,我编写了自己的 PowerShell 模块来查看和更改 GAC。 可以在 http://powershellgac.codeplex.com 上找到。
该项目已移至 GitHub。 您现在可以在以下位置找到它:
https://github.com/LTruijens/powershell-gac
还可以在 PowerShell 库中找到它:
https://www.powershellgallery.com/包/Gac/1.0.1
I had the same question. The question became more prominent with .Net 4.0 and there not being a Windows Explorer shell plugin available to view the contents. GacUtil works, but is not flexible enough and takes a lot to install. The PowerShell Community Extensions option is to limited in it's functionality and contains to many other CmdLets that I don't need. Therefore I've written my own PowerShell module to view and change the GAC. It can be found on http://powershellgac.codeplex.com
This project has moved to GitHub. You can now find it on:
https://github.com/LTruijens/powershell-gac
It can also be found in the PowerShell Gallery:
https://www.powershellgallery.com/packages/Gac/1.0.1
您只需从命令提示符即可完成此操作:
GAC 具有特定的目录结构,您不应使用命令提示符移动或删除其中的内容 - 而是使用 Windows 资源管理器 (gui) 或 gacutil (cli)
You can do it just from a command prompt:
The GAC has a specific directory structure, and you should not go moving or deleting things in there using the command prompt - rather use windows explorer (gui) or gacutil (cli)
如果您想在 GAC 中搜索特定程序集。
另请注意,由于 MS 更改了 GAC 结构,因此您可以使用根目录中的 -Recurse 选项来搜索所有 GAC。
If you want to search for a specific assembly in the GAC.
Also note, since MS has changed the GAC structure you can use the -Recurse option from the root to search all the GAC.
我使用以下代码片段成功列出了 GAC:
解决方案取自 这里。
I successfully listed GAC using this code snippet:
Solution taken from here.
另一种选择是 PowerShell 社区扩展 安装 GAC 提供程序,因此您可以执行以下操作:
如果您使用的是 PowerShell V2 ,一定要抢1.2 Beta。
Another option is that the PowerShell Community Extensions installs a GAC provider, so you can do this:
If you are on PowerShell V2, be sure to grab the 1.2 Beta.
如文档中所述:
您可能想在适当的子目录中进行搜索,甚至在这两个子目录中进行搜索。
As stated in the docs:
You may want to search in the appropriate subdir or even in both of them.
列出 GAC 中的条目;
在 powershell 中,您可以解析上面的文本输出。
我不知道有什么托管界面可以检查 GAC。
To list entries in the GAC;
In powershell you could parse the text output of the above.
I don't know of a managed interface to inspect the GAC.