何时需要使用 GAC 共享程序集?

发布于 2024-11-06 16:22:01 字数 553 浏览 7 评论 0原文

可能的重复:
我应该何时将程序集部署到 GAC 中?

根据 MSDN 文档:

您应该仅在需要时将程序集安装到全局程序集缓存中来共享程序集。作为一般准则,请将程序集依赖项保持私有,并在应用程序目录中查找程序集,除非明确要求共享程序集。

什么时候“明确需要”共享程序集?如果需要程序集共享,您可以通过XCOPY DEPLOYMENT à la 私有程序集将相同的程序集物理分布在不同位置。我不明白这个一般准则。

Possible Duplicate:
When should I deploy my assemblies into the GAC?

As per MSDN documentation:

You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private, and locate assemblies in the application directory unless sharing an assembly is explicitly required.

When is sharing an assembly "explicitly required"? If assembly sharing is required, you can physically distribute the same assembly on different locations via XCOPY DEPLOYMENT à la Private Assemblies. I don't understand this general guideline.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

氛圍 2024-11-13 16:22:01

我倾向于遵循的一般规则是,如果一个程序集将由同一台计算机上的多个应用程序使用,则它应该进入 GAC,即您已经构建了自己的有用代码框架。

如果您只有一个应用程序,通常最好只使用 bin 文件夹。

请注意,如果您想部署到 GAC,您需要对程序集进行签名(使用强名称密钥)和版本控制。

A general rule I tend to follow is that if an assembly is going to be used by multiple applications on the same machine it should go in the GAC i.e. you have built your own Framework of useful code.

If you just have one application it is normally best to just use the bin folder.

Take note if you want to deploy to GAC you need to sign (with a strong name key) and version your assemblies.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文