代码改变世界

[转]VS2008在64位Windows平台上编译ArcEngine导致HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)错误的解决办法

  flyingfish  阅读(3534)  评论(1编辑  收藏  举报

VS2010在WIN7 X64上编译以前在x84 XP上的Skyline程序遇到同样问题,参照如下此贴解决。

 

---------------------

VS2008 在64位的系统(XP/Vista/Win7均是)中编译ArcEngine(9.3SP1)并运行时提示:

没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))

原因:ArcEngine9.3没有原生支持64位,而是以32位兼容方式运行

解决办法:在项目属性里设置“生成”=>“目标平台”为x86而不是默认的ANY CPU.

ESRI官方也是这么解决的:

http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=33000

Bug:  Error: Class not registered(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)

Article ID: 33000
Bug Id: NIM007516
Software:  ArcGIS Engine Runtime 9.2, 9.3
Platforms:  Windows 2000, XP

 

Description

Running an application from Visual Studio 2005 on 64-bit computers, displays the following error message: 

 

"Error : Class not registered(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)"

Cause

When running a Visual Studio application, the default Common Language Runtime (CLR) platform in the Visual Studio is set to Any CPU. This default must be changed on 64-bit computers to compile the assemblies with the 32-bit, x86 compatible CLR.

Workaround

Change the default Platform Target CPU to allow applications to run on 64-bit machines:

 

 

  1. Right-click on the solution in the Visual Studio Solution Explorer and open the Properties window.
  2. Click the compile tab: Visual Basic, or the build tab: Visual C#.
  3. For Visual Basic, click the Advanced tab.
  4. Select x86 as the Target CPU (Visual Basic) or Platform Target (Visual C#).
  5. Rebuild the solution.

Created: 5/4/2007
Last Modified: 10/30/2009

编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2008-10-04 [转]CheckedlistBox绑定数据库,并获得所有选中的值(ValueMember)和显示值(DisplayMember)
点击右上角即可分享
微信分享提示