首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >IntPtr.Size总是4,尽管在64位操作系统上有AnyCPU。

IntPtr.Size总是4,尽管在64位操作系统上有AnyCPU。
EN

Stack Overflow用户
提问于 2017-01-11 19:16:46
回答 1查看 1.3K关注 0票数 4

我正在构建一个Outlook外接程序,它运行在64位操作系统和64位Outlook上。

但是,我无法获得正确的指针大小来触发RedemptionLoader代码来加载64位DLL文件.它总是给我4的指针大小。

我读过下面的文章,也遵循了他们的建议,但不去.

https://stackoverflow.com/questions/9206483/why-intptr-size-is-4-on-windows-x64

https://stackoverflow.com/questions/2846666/intptr-in-32-bit-os-uint64-in-64-bit-os

因此,在我的项目,一个C#项目的Visual Studio 2015中,我已经将它设置为任何CPU,然后在我的64位WiX安装项目中,我确保它将x64作为$(Platform)。就像这样,

代码语言:javascript
运行
复制
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">

当我试图加载我的外接程序并转储出指针大小"Pointer size? " + IntPtr.Size时,它只打印4而不是我所期望的8.

我还缺什么.?

Windows 10 64位

Office 365,Outlook 64位

操作系统和Outlook都是64位:

即使在安装外接程序期间,外接程序Express也检测到并安装为64位版本,而不会抛出任何错误.

代码语言:javascript
运行
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2017-01-11 19:33:49

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

Outlook真的说它是64位吗?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41598986

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档