操作方法:复制依赖程序集,以防它不在 GAC 中?

发布于 2024-07-10 20:00:36 字数 486 浏览 5 评论 0原文

我正在使用 VS2008 构建安装包。 这是安装 Outlook 的 COM 加载项应用程序的常规安装包。 到目前为止,它工作正常。 但是我需要稍微改进一下...

故事是安装包将所有依赖程序集复制到加载项的安装文件夹中。

例如,COM 加载项依赖于 Microsoft.Office.Interop.Outlook.dll 程序集。 因此,安装包将其复制到其文件夹中:)

当然,我可以将 Microsoft.Office.Interop.Outlook.dll 依赖项的 Exclude 属性切换为 True,这将阻止复制程序集。 但是,我需要实现以下行为:

  • 如果 Microsoft.Office.Interop.Outlook.dll 不在 GAC 中,我们只需将其复制到加载项的安装文件夹中
  • 否则,请使用 GAC 中的那个

请建议ti可以在.Net2.0中完成的方式吗? 一步一步的指导将非常感激。

I am building a Setup Package using VS2008. This is a regular setup package installing a COM Add-In app for Outlook. It works Ok, so far. However I need to improve it a little...

The story is that installation package copies all dependent assemblies into the installation folder of the add-in.

For example, the COM Add-In depends on Microsoft.Office.Interop.Outlook.dll assembly. So installation package copies it to its' folder :)

Of course, I can switch Exclude property of the Microsoft.Office.Interop.Outlook.dll dependency to True which will prevent the assembly from being copied. However, I need to achieve the following behavior:

  • In case Microsoft.Office.Interop.Outlook.dll is not in GAC, we simply copy it to the installation folder of the Add-In
  • Otherwise, use the one which is in GAC

Please suggest the way ti can be done in .Net2.0?
A step by step guide will be really appreciated.

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

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

发布评论

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

评论(1

睫毛溺水了 2024-07-17 20:00:36

只需将其始终复制到文件夹即可。 如果它已经在 GAC 中,则无论如何都会首先使用 GAC 的程序集。

换句话说,运行时首先检查 GAC。 然后,检查应用程序库等。

http://msdn .microsoft.com/en-us/library/yx7xezcf(VS.71).aspx

Just always copy it to the folder. If it's already in the GAC, the GAC'd assembly will be used first anyway.

In other words the runtime checks the GAC first. Then, checks application base, etc.

http://msdn.microsoft.com/en-us/library/yx7xezcf(VS.71).aspx

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