It's strongly recommended to avoid managed code in custom actions. Best
practice is to keep your custom actions entirely self-contained, which
generally means writing them in C++ and statically linking to the C  runtime
library. That's how all of WiX's custom actions are built.

What does 'MyCustomActions' do? It may be that the tasks it performs can be
performed with native Windows Installer functionality or existing WiX custom
actions that were not available through InstallShield.

-- 
Mike Dimmick 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of WenWu Ru
Sent: 09 November 2006 15:59
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] CreateObject in C++ for .NET COM interop?

Our installer includes a .NET assembly component MyCustomActions.dll, which
is marked with !0.NET COM interop!1 in InstallShield.  At installation,
InstallShield runs "regasm MyCustomActions.dll /regfile MyCustomActions.reg
/Codebase" to create registry entries on the target system to allow COM
objects to call the .NET assembly.  MyCustomActions.dll assembly contains a
class that is derived from System.ComponentModel.Component and is marked
with [ComVisible(true)].  A few custom actions written in InstallScript
calls CreateObject to create an object instance and invokes the functions.  
For example:

            set ojb = CreateObject("MyCustomActions.TestClass1");
            result = obj.TestMethod1();

Now that I am converting it to WIX, I need to write the equivalent code in 
C++ for CreateObject.  From what I understand, I need to import the type
library for MyCustomActions.dll and create an interface pointer with
CoCreateInstance.  However, MyCustomActions.dll assembly does not explicitly
declare any interface, and currently no type library is created in the build
or install process.  How does CreateObject create the instance and invoke
the method?  I am hoping that I do not have to modify the source code and
build script for MyCustomActions.dll.

Thanks,
-WenWu
P.S.  Instead of importing the type library, another idea I tried but failed
is to import the ProgID, e.g. #import "MyCustomActions.TestClass1".  Maybe I
am not using the correct import attributes?

_________________________________________________________________
All-in-one security and maintenance for your PC.  Get a free 90-day trial! 
http://clk.atdmt.com/MSN/go/msnnkwlo0050000002msn/direct/01/?href=http://www
.windowsonecare.com/?sc_cid=msn_hotmail




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to