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

DotNetCoCreateObject Error in IS 2012

My installer cannot call DotNetCoCreateObject.
It gives error number -2147219705.
I've read through as many articles and posts on this error as I can and done all of the fixes but it's still not working. I must be missing something.
The assembly is ComVisible.
The DLL is in the SUPPORTDIR at IS runtime.
The assembly uses the 4.0 framework but I've upgraded to IS 2012 so that shouldn't be an issue, either.

Here's the code:
set helper = DotNetCoCreateObject(SUPPORTDIR ^ "RunSQLScripts.dll","RunSQLScripts.ScriptHelper","");

What am I missing?

Thanks in advance for any help.
Labels (1)
0 Kudos
(5) Replies
Level 2

I have exactly the same problem. We built the installer originally in Installshield 2009 with .NET framework 2.0 and have been using it for 3-4 years.

We have now updated our software to utilize .NET framework 4.0 and upgraded to Installshield 2012. The same DotNetCoCreateObject method that has worked should work now from what I have read, but we now get the error number -2147219705. If anyone figures out how to make this work, please let me know. Thanks in advance for any help.
0 Kudos
Level 6

I am also running into the issue where DotNetCoCreateObject is failing. Has anyone else found a solution to this problem.

Robert M.
0 Kudos
Level 6

I'm also running into the same error.
0 Kudos
Level 3

There is conflicting information on various posts about whether UseDLL is required before DotNetCoCreateObject. Either way, it does not work for me. I have ComVisible set to TRUE, the DLL exists in the path.

Can someone from Flexera jump in here?
0 Kudos
Level 5

Have you got the following line in your AssembyInfo.cs file for your dll?
[assembly: ComVisible(true)]

And for each class and method you want to call they need to have the following attribute...

AND Com does not allow static methods to be called, this causes InstallShield to crash without error!

You do NOT need UseDLL.

Here is an example of how to call from InstallScript...
set obj= DotNetCoCreateObject("D:\\MyWibble.dll", "MyCompany.MyWibble.MyClass", "MyCompany.MyWibble");

obj.TestMethod("TestString1", "TestString2");

set obj = NOTHING;

In your C# assembly...
[CODE]namespace MyCompany.MyWibble
public class MyClass
public void TestMethod(string testString1, string testString2)
// Do something

and in your c# assembly AssemblyInfo.cs
[CODE][assembly: ComVisible(true)][/CODE]
0 Kudos