何时需要使用 GAC 共享程序集?
可能的重复:
我应该何时将程序集部署到 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我倾向于遵循的一般规则是,如果一个程序集将由同一台计算机上的多个应用程序使用,则它应该进入 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.