vsdraCOM causes the codebase path to point to build path

962 views Asked by At

We have a couple of dlls we like to install using an msi.

In our test environment, we are using regasm -codebase to register the dlls.

As I understand from googling, this is accompliched in an msi project by setting the register property to vsdraCOM.

The problem is that when we run the installer and checks the registry, the codebase path is set to the path the file were in when building the msi.

2

There are 2 answers

0
PhilDW On

I'm going to expand on Hans' answer and that link info, and it may be more than a comment can hold.

That reg file will contain the path to the file and the link article recommends using [TARGETDIR], which is basically wrong if the file is not being installed to the application folder. The path to your file should be written as [#file-key] in the reg file that you import. In a VS setup project the file-key will be (just an example) something like _B049230C37DE4B6787C578DCEE30252A. Open your MSI file with Orca, go to the File Table and use the file key in the File column that corresponds to your file name.

That comes from here:

http://msdn.microsoft.com/en-us/library/aa368609%28v=vs.85%29.aspx

the 7th bullet point. It resolves to the file path wherever it is installed to.

The other thing that can be done is to let Visual Studio do its incorrect thing, then go to the Registry table with Orca, find the path and put that [#file key] in it such as [#_B049230C37DE4B6787C578DCEE30252A] and people sometimes do those kinds of updates with a post build script to update the MSI.

None of these are great, but they should work and get you out of using the GAC. VS setup projects really should be using that [#file key] syntax, and it's just a silly bug I assume.

0
Christopher Painter On

Speaking as someone who's made a full time living writing installs for 18 years, my first suggestion would be to switch to Windows Installer XML. If you insist on using .VDPROJ, I would suggest reading: Redemption of Visual Studio Deployment Projects.

The concept is you use Windows Installer XML to create a merge module and then consume that merge module with .VDPROJ. In Wix, you use Heat to harvest the DLL. It will extract the COM / Regasm metadata and author it as Registry table entries. This provides a nice clean encapsulation using authoring best practices and avoids the need to do any post build hacking of the built MSI database.