tags:

views:

845

answers:

1

I want to use regasm.exe to register a .net dll as a COM object. I am running into a problem which is causing the intstaller to not work. I believe it is because the file I want to register has not made it to the installed directory by the time I want to run the command. But there error log does not say enough about the install error for me to know. Any ideas, how to make sure the file is moved to "program files" before I run the custom command?

Here is what I am using:

  <InstallExecuteSequence>
    <Custom Action='comReg' After='InstallFinalize'>NOT REMOVE</Custom>
    <Custom Action='comUnreg' Before='RemoveFiles'>REMOVE</Custom> 
  </InstallExecuteSequence>

  <CustomAction Id='comReg' Directory='INSTALLDIR' 
 ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\regasm.exe" "[INSTALLDIR]my.dll"' Return='check' />

  <CustomAction Id='comUnreg' Directory='INSTALLDIR' ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\regasm.exe" /u "[INSTALLDIR]my.dll"' Return='check' />
+3  A: 

Why do you want to do that? You'll lose all the rollback that capturing that registration in the appropriate MSI tables would provide. Plus, with that scheduling, you're going to have problems with elevation.

I highly recommend using heat.exe to capture the regasm of your assembly and using the declarative approach instead.

Rob Mensching
I would much prefer to use heat.exe but I am not sure how to. I am using Visual Studio 2005 and I would prefer not to use the command line (for version control reasons). Is there a way to do it all in VS?
Jono
Just run heat.exe once, then check the result into version control. Update (re-run heat.exe) when necessary.
Rob Mensching
I am having trouble finding how to register the dlls with heat. Here is what I am doing: "heat.exe file my.dll -gg -out my.wxs". Then add the .wxs file to my project. Compile and install. Run OleView and dont see the entry. I am certainly missing a step somewhere. Any ideas?
Jono
Did you add a reference to the new Component from a Feature in your Product somewhere?
Rob Mensching