I was trying to create an msi file using the Visual Studio Setup Project that would register one of my ComVisible assemblies and make it available for use within a VB6 application. I found this post
, specifically Ian Turner’s response, to be very helpful. The unfortunate side effect of using the RegistrationServices class
for registering the assembly for COM Interop was that it does not
generate and register the type library.
Now; I have only ever done VB6 on some pretty minor projects and my exposure to it was limited at that. I am not certain why type library generation and registration is necessary, but the VB developer I work with insisted that the type library be registered for him to use it (if anyone knows a method to create the necessary objects in VB6 without requiring type library registration, please post a reply).
Here are the steps I am doing currently (I plan to port this to a nant build script and will post that solution when I get there, for the time being, here’s what I did within Visual Studio):
- Add a post-build event to the ComVisible assembly project: "$(DevEnvDir)….SDKv2.0Bintlbexp" $(TargetFileName) /out:com.MyAssemblyName.tlb
- Build the target Assembly.
- Add the generated tlb file to the Application Folder of the File System items of the Setup project.
- Ensure that the Register property of the file (right-click on the file and select Properties) is set to vsdrfCOM.
Of note is that the Register property of the project output for the target assembly (within the Setup project) is set to vsdrpCOM (I didn’t change this so I assume it is the default) which is responsible for registering the assembly for COM Interop. The steps above are resposible for generating and registering the type library.