C# IntPtr.Size始终为4,尽管64位操作系统中有任何CPU

C# IntPtr.Size始终为4,尽管64位操作系统中有任何CPU,c#,outlook,64-bit,outlook-redemption,C#,Outlook,64 Bit,Outlook Redemption,我正在构建一个Outlook加载项,该加载项在64位Outlook操作系统上运行。 但是,我无法获得正确的指针大小,以便触发RedemptionLoader代码来加载64位dll。。。它总是给我指针大小是4 我已经阅读了下面的内容,也采纳了他们的建议,但是没有去 因此,在我的项目Visual Studio 2015中的C#项目中,我将其设置为任何CPU,然后在我的64位WiX设置项目中,我确保它具有x64作为$(平台)。这样, <PropertyGroup Condition=" '$

我正在构建一个Outlook加载项,该加载项在64位Outlook操作系统上运行。 但是,我无法获得正确的指针大小,以便触发RedemptionLoader代码来加载64位dll。。。它总是给我指针大小是4

我已经阅读了下面的内容,也采纳了他们的建议,但是没有去

因此,在我的项目Visual Studio 2015中的C#项目中,我将其设置为
任何CPU
,然后在我的64位WiX设置项目中,我确保它具有
x64
作为
$(平台)
。这样,

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">

如果是4,则可以确保进程是32位的。编译为“任意CPU”将匹配主机应用程序(Outlook)的位,而不是主机操作系统


Outlook是否真的说它是64位的?

您确定主进程是64位的吗?是的。。。上面写着64位,我真的不知道为什么它会打印4。我构建外接程序的计算机安装了32位Outlook,但我认为这在目标计算机上并不重要?调试时是否使用VSTO宿主进程?我确实在属性Debug>Enable Debuggers>“Enable The Visual Studio宿主进程”中看到了该选项,并且选中了该框。那就是你说的那个吗?我已经取消选中该框并重建了解决方案,仍然是一样的…如果明确针对x64,会发生什么?我已经完全创建了一个全新的安装程序项目,重建并重新打包了整个项目,安装了它,一切运行正常,您的赎回甚至加载了正确的64位dll,只有在卸载过程中,它才会尝试加载32位(由于指针大小为4)这完全是mind=Blow。。。
Add-in Express Registrator Log File: 01/11/2017 15:36:47

Installation directory: C:\WINDOWS\Installer\
Registrator version: 8.4.4395.0
Operating System: Microsoft Windows 10 Professional (build 14393), 64-bit
Process Owner: System
Command Line: "C:\WINDOWS\Installer\MSI5FB0.tmp" /install="C:\Program Files\Blah\Blah.dll" /log=%RoamingAppDataFolder%/Blah
Run 'As Administrator': Yes
Process Elevated: Yes
Integrity Level: System
UAC (User Account Control): On
--------------------------------------------------------------
15:36:47 0448 Starting the add-in registration process.
15:36:47 0448 Loading mscoree.dll
15:36:47 0448 Success.
15:36:47 0448 .NET Framework installation directory: 
15:36:47 0448 The latest version of .NET Framework: 'v4.0.30319'
15:36:47 0448 Loading CLR: v4.0.30319.
15:36:47 0448 Calling CLRCreateInstance method.
15:36:47 0448 Success.
15:36:47 0448 Calling GetRuntime method.
15:36:47 0448 Success.
15:36:47 0448 Checking if the hosting API of .NET Framework v4.0 beta is installed.
15:36:47 0448 The hosting API is up to date.
15:36:47 0448 Calling GetInterface method for the CorRuntimeHost interface.
15:36:47 0448 Success.
15:36:47 0448 Starting CLR...
15:36:47 0448 Success.
15:36:47 0448 Getting the CLR version.
15:36:47 0448 The CLR v4.0.30319 has been initialized successfully.
15:36:47 0448 Creating a new domain setup.
15:36:47 0448 Success.
15:36:47 0448 The 'shadow copy' is disabled.
15:36:47 0448 Creating a new application domain.
15:36:47 0448 Success.
15:36:47 0448 Getting the base directory for the domain.
15:36:47 0448 Success. The directory is 'C:\Program Files\Blah\'.
15:36:47 0448 Searching for the Add-in Express core library.
15:36:47 0448 Success. The 'AddinExpress.MSO.2005.dll' file is found.
15:36:47 0448 Creating an instance of the 'AddinExpress.Deployment.ADXRegistrator' class.
15:36:47 0448 Assembly identity is 'AddinExpress.MSO.2005'.
15:36:47 0448 Success.
15:36:47 0448 Unwrapping the instance of the 'AddinExpress.Deployment.ADXRegistrator' class.
15:36:47 0448 Success.
15:36:47 0448 Calling the managed registration procedure (DISPID = 1610743823).
15:36:48 0448 Registration success.
15:36:48 0448 The add-in registration process is completed with HRESULT = 0.