简体   繁体   English

Visual Studio VSTO 32 位和 64 位版本

[英]Visual Studio VSTO 32-bit and 64-bit builds

I am writing an Outlook VSTO addin using Visual Studio.我正在使用 Visual Studio 编写 Outlook VSTO 插件。 The addin uses SQLite.插件使用 SQLite。 It needs a dll called SQLite.interop.dll.它需要一个名为 SQLite.interop.dll 的 dll。 This comes in a 32-bit version and 64-bit version, and Outlook wants the correct version.这有 32 位版本和 64 位版本,Outlook 需要正确的版本。 If the end user is running a 32-bit version of Office on a 64-bit CPU, Outlook needs the 32-bit version of the dll, and the 64-bit version doesn't work.如果最终用户在 64 位 CPU 上运行 32 位版本的 Office,则 Outlook 需要 32 位版本的 dll,而 64 位版本不起作用。 Three questions:三个问题:

  1. Is there a way of detecting whether the user is running a 32-bit or 64-bit version of Office?有没有办法检测用户运行的是 32 位还是 64 位版本的 Office?
  2. Is it possible in Visual Studio to do two builds of the same project, one containing the 32-bit dll and one containing the 64-bit dll, or do I need two separate projects?是否可以在 Visual Studio 中对同一个项目进行两次构建,一次包含 32 位 dll,另一次包含 64 位 dll,或者我是否需要两个单独的项目?
  3. Is there some other way of managing this?有没有其他方法来管理这个?

Thanks,谢谢,

Paul保罗

Your addin is always running with the same bitness as Outlook, just compile it as "Any CPU".您的插件始终以与 Outlook 相同的位数运行,只需将其编译为“任何 CPU”即可。

Keep both dlls (or embed them as resource), and at run-time determine the bitness by evaluating the size of the IntPtr type - 4 for 32 bit, and 8 for 64. Then extract/load the dll of the right bitness.保留两个 dll(或将它们作为资源嵌入),并在运行时通过评估 IntPtr 类型的大小来确定位数 - 32 位为 4,64 位为 8。然后提取/加载正确位数的 dll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio - 在64位项目中编译32位代码 - Visual Studio - Compiling 32-bit code inside 64-bit project 配置Visual Studio以创建32位和64位配置 - Configuring Visual Studio to create 32-bit and 64-bit configurations Visual Studio 中的“首选 32 位”在控制台应用程序 (.NET Core) 下生成 64 位代码 - 'Prefer 32-bit' in Visual Studio Generates 64-bit Code Under Console App (.NET Core) 在 64 位机器上使用 Visual Studio 编译 32 位应用程序 - Compiling 32-bit application using Visual Studio on a 64-bit machine Visual Studio 32 位链接器如何找到 64 位链接器? - How does the Visual Studio 32-bit linker find the 64-bit linker? Visual Studio:如何为包含32位和64位平台的项目设置Qt? - Visual Studio: How to setup Qt for a project that contains both 32-bit and 64-bit platforms? Visual Studio 64位编译器可以编译32位Excel加载项吗? - Can 32-bit Excel load add-in which is compiled by visual studio 64-bit compiler? 我可以在一个Visual Studio构建中构建32位和64位MSI吗? - Can I build 32-bit and 64-bit MSI in one Visual Studio build? 是否可以在不重新启动Visual Studio的情况下编译32位和64位配置? - Is it possible to compile both 32-bit and 64-bit configurations without restarting Visual Studio? 使用VISTA 64位配置新的开发人员PC:我可以使用32位Visual Studio吗? - Configuring new developer PC with VISTA 64-bit: can I use my 32-bit Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM