kevinmm
kevinmm

Reputation: 3376

How to implement COM interop in a non-msi installer

I am attempting to distribute a .NET Wizard form for Visual Studio, using a non-msi installer. For the sake of simplicity, let's focus on Visual Studio 2008.

So, as part of the post-build process of the assembly, I call:

regasm /regfile C:\path\to\my\assembly.dll

Then, pack the generated regfile and use regedit to merge this with the end users registry. I see that the assembly name and CLSID are generated properly and placed into HKEY_CLASSES_ROOT and HKEY_CLASSES_ROOT\CLSID, respectively.

However, on the Visual Studio side of things, after the installation is complete, I get an error. To elaborate, the Wizard is seen in the "Add New Items", via the vsdir file. This points to the vsz file, where Visual Studio sees the appropriate COM class. I can tell that it sees this class in HKEY_CLASSES_ROOT because the error message actually displays the correct CLSID:

Class not registered. Looking for object with CLSID: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

I am not entirely sure what the problem is. I know that the old InstallShield project had a simple check box for installing assemblies as COM interop. Unfortunately, this is not available to me. Perhaps that isn't really the problem and I am missing something from the Visual Studio 2008 installation side of things.

Any ideas or debugging help would be greatly appreciated. First and foremost, I want to verify that the assembly is correctly installed for COM interop. I have never used COM before, so it is all greek to me. :)

Edit: I should mention that this same assembly was build and distributed just fine with an "old" InstallShield project. Therefore, I know the problem lies within my own understanding/implementation of adding a .NET COM Wizard to the Visual Studio Add Items dialog.

Upvotes: 1

Views: 148

Answers (1)

Dominic Cronin
Dominic Cronin

Reputation: 6191

Does your class (or assembly) have the Com visible attribute set to true?

Upvotes: 1

Related Questions