Win7安装ObjectArx2010心得【ERROR CODE:2738】

2012-04-01 23:23:45|?次阅读|上传:wustguangh【已有?条评论】发表评论

关键词:C/C++, ObjectArx, AutoCAD|来源:唯设编程网

进行CAD二次开发,首先得配置相关环境,根据网上的介绍,VS2008对应的ObjectArx版本是ObjectArx2010,安装AutoCAD的过程比较顺利,就是找注册机有点困难,但终究还是百度出来了。好了,轮到安装ObjectArx2010了,起初以为很简单,但经安装过程中却发现并非如此,程序老是弹出ERROR CODE:2738这种错误,错误对话框如下:

安装ObjectArx2010出现的2738错误

百度、Google折腾了一个晚上,资料很少,还是老外牛逼,在他们的论坛上面找到了解决方法,把它列出来,以备以后查阅。根据网友们的经验,出现这个情况主要有以下几种可能的导致因素:

1. Win7环境你运行安装包的权限不够;

2. 你的杀毒软件禁止了VBScript的运行权限;

如果是由于这两个因素引起的安装错误,你可以以管理员权限启动安装包可以解决权限问题,.MSI点击右键是没有“以管理员方式启动”这个选项的,你可以写一个批处理程序启动.MSI安装程序,启动批处理程序时使用"以管理员方式启动"即可,第二个问题你关闭杀毒软件就轻易解决了,如果依然不行,你可以尝试重新注册支持VBScript运行的组件。在使用VS2005+ObjectArx2008+CAD2008的时候,我使用这些方法成功搭建了CAD的二次开发环境。但是在Win7环境配置VS2008+ObjectArx2010+CAD2010的时候,上面的办法却依然没有解决我的问题,最终搜到了下面这些论述,把问题终于解决了:

How I resolved Windows Installer error code 2738 on Vista while running light.exe from WiX v3.0

Recently, while attempting to build a Japanese MSI using WiX v3.0, I received an error message that looked like the following:

light.exe : error LGHT0217 : An unexpected external UI message was received: ????????????????????????????????????????????????????????????? ???? 2738 ???

I wanted to see the full text of this error message, so I temporarily changed the product language setting in my WXS file from 1041 (the LCID for Japanese) to 1033 (the LCID for English) and re-ran the build.  When I did that, the error message was more readable:

light.exe : error LGHT0217 : An unexpected external UI message was received: The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2738.

This message made more sense to me, so from there, I looked at the Windows Installer Error Messages reference for error code 2738 and found the following:

Could not access VBScript run time for custom action [2].

While attempting to narrow down this error further, I found a couple of useful blog posts.  As described in this blog post by Heath Stewart, error code 2738 can occur on Windows Vista systems (like the one I was using in the above scenario) if an MSI contains a script-based custom action and the VBScript runtime is registered in the HKEY_CURRENT_USER hive instead of or in addition to the HKEY_LOCAL_MACHINE hive.  Also, as described in this blog post by Bob Arnson, four of the Windows Installer Internal Consistency Evaluators (ICEs) are implemented in VBScript.  The offending ICEs are ICE08, ICE09, ICE32 and ICE61.

In my build output, I noticed that light.exe had reported some warnings for ICE03 before displaying this 2738 error.  From this, I made an educated guess that it was probably failing while running one of these four ICEs.  Then, I used some of the advice that I listed in one of my previous blog poststo unregister vbscript.dll and jscript.dll from HKEY_CURRENT_USER to resolve this error:

  1. Click on the Start menu, choose Run, type cmd and click OK
  2. To unregister the VBScript engine, run this command:  reg delete "HKCUSOFTWAREClassesCLSID{B54F3741-5B07-11CF-A4B0-00AA004A55E8}" /f
  3. To unregister the VBScript engine on a 64-bit OS, run this command:  reg delete "HKCUSOFTWAREClassesWow6432NodeCLSID{B54F3741-5B07-11CF-A4B0-00AA004A55E8}" /f
  4. To unregister the JScript engine, run this command: reg delete "HKCUSOFTWAREClassesCLSID{F414C260-6AC0-11CF-B6D1-00AA00BBBB58}" /f
  5. To unregister the JScript engine on a 64-bit OS, run this command: reg delete "HKCUSOFTWAREClassesWow6432NodeCLSID{F414C260-6AC0-11CF-B6D1-00AA00BBBB58}" /f

Once I did that, my build started working as expected.  I still do not know how this information ended up in HKEY_CURRENT_USER on my system, particularly because the same build worked correctly on the same machine a couple of days ago.  However, I am now back into a state where I can build successfully, and I know of a possible workaround to try if I end up with similar build issues in the future.

<update date="12/19/2011"> Added steps to unregister the VBScript and JScript engines on 64-bit OS's. </update>

通过该文介绍的方法,将注册表中的"HKCUSOFTWAREClassesCLSID{B54F3741-5B07-11CF-A4B0-00AA004A55E8}"删除,就可以正常安装ObjectArx2010了,在此对该文的作者表示感谢。

为了是安装更加方便,我写了一个批处理程序实现删除注册表指定的键,注册支持VBScript运行的组件,启动.MSI安装程序,批处理程序的完整代码如下:

@echo off
set dir=%cd%
cd %windir%system32
%windir:~0,2%

reg delete "HKCUSOFTWAREClassesCLSID{B54F3741-5B07-11CF-A4B0-00AA004A55E8}"

regsvr32 vbscript.dll

cd %dir%
%dir:~0,2%
ArxWizards.msi
exit

新建一个文本文档,将以上代码保存到其中,然后将文本文档的.txt后缀改成.bat,以管理员方式运行,终于将ObjectArx2010安装到电脑上了!!!

发表评论0条 】
网友评论(共?条评论)..
Win7安装ObjectArx2010心得【ERROR CODE:2738】