cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mark_s
Level 3

Troubles with DotNetCoCreateObject

I can't figure out how to use DotNetCoCreateObject.
I have verified my assembly and supporting files are all going to SupportDir (temp folder under user's LocalSetting folder).

Here is the code I'm using:
	dllPath = SUPPORTDIR ^ "DBInstall.dll";
exeClass = "DBInstall.AInstall";
try
set oInstall = DotNetCoCreateObject(dllPath, exeClass, "");
catch
/**/ MessageBox("oInstall ERROR: " + Err.Number + " ERROR Description: " + Err.Description + " ERROR Source: " + Err.Source, SEVERE);
endcatch;


My assembly has 'Make COM visible' checked. Do I need to worry about Namepace?

The above code catches the following error:
Number: -2147219705
Description: [nothing]
Source: ISRT._DotNetCoCreateObject

I added a UseDLL() call prior to the DotNetCoCreateObject to make sure the dll is accessible, and that call is successful.

I'm running this code from the Installing event. Is that ok?

I've been staring at this code for hours and can't make any progress. Any suggestions would be very much appreciated. Thanks.
Labels (1)
0 Kudos
(6) Replies
Christopher_Pai
Level 16

What project type is this?
0 Kudos
mark_s
Level 3

Christopher Painter wrote:
What project type is this?

If you are talking about the assembly I'm attempting to like to, it is a VB.net 3.5 sp1 class library application. Created with VS2008. This assembly is used to install the database by launching a RedGate Packager 6 executable.

If you are talking about the InstallShield project, I'm not sure. It installs .Net, a database and an application.
0 Kudos
Christopher_Pai
Level 16

It should say in the title bar if it's a Basic MSI, InstallScript MSI or InstallScript project type.
0 Kudos
Dan_Galender
Level 10

Is .NET Framework installed on the machine? If so, what version(s)?
0 Kudos
mark_s
Level 3

I figured out the issue. The problem turned out to be embarassingly simple on my part. I did not include the Namespace in the Assembly+Class parameter for the method.

Now I have to figure out how to retrieve the Username and Password provided for SQL Server in an earlier step in the setup...

Thanks again for your help.
0 Kudos
Christopher_Pai
Level 16

While dotNetCoCreateObject() is nice, I would really encourage you to consider WiX's DTF instead. It'll encapsulate your .NET Class as a Type1 CA which you can easily consume in your InstallScript MSI project type.

http://blog.deploymentengineering.com/2008/07/reasons-dtf-is-better.html
0 Kudos