cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sagar_doshi
Level 2

DotNetCoCreateObject not able to create object

Hi,

I am new to installshield 2011 and trying to use DotNetCoCreateObject in my installscript for installscript msi project.

It is not able to create object for my .Net4.0 dll and failes with error code -2147219705.

My code snippet is as below:

try szPath=TARGETDIR+"trial\\Encryption.dll";
LongPathToShortPath(szPath);
set oEncrypt=DotNetCoCreateObject(szPath,"Encryption.Encrypter","");
if(IsEmpty(oEncrypt)) then
MessageBox("Error",SEVERE);
endif; returnValue=oEncrypt.Encrypt(svSetupExeDir,"HAF7DAHASDS");
catch
MessageBox(Err.Description,SEVERE);
abort;
endcatch;

On debugging found that messagebox is displayed from try & catch block and not from if block.

Please let me know what am i doing wrong.
Any help is appreciated.

Thanks in Advance,
SagaR
Labels (1)
0 Kudos
(2) Replies
reshmi_patro
Level 3

You can set assembly: ComVisible(false) to assembly: ComVisible(true). The exception will not come.
0 Kudos
Christopher_Pai
Level 16

DotNetCoCreateObject was great when it came out but I no longer reccomend using it. I suggest looking at WiX DTF custom actions. I've blogged about it extensively and it's basically a way of getting the best of the C++ world and the best of the C#/.NET world and it's fully compatible with InstallShield.
0 Kudos