PDA

View Full Version : Managed code - including reference to "Interop.WindowsInstaller"



sharon
07-02-2008, 06:49 AM
Hi all,

I'm referencing Interop.WindowsInstaller in my c# code for custom actions in order to get/set msi properties during installation .
The problem is, that during installation I get an execption telling that this file cannot be found, UNLESS I copy Interop.WindowsInstaller.dll to the system32folder in the target machine where the installation is being run.

I would like to know if anyone has encountered this issue, and if there is a solution other than installing this file in the target system.


Thanks,
Sharon.

MichaelU
07-02-2008, 10:08 AM
You're doing this as part of a new Managed Code Custom Action, right? If so, there's a solution for this doesn't have UI (we're tracking that under IOC-000073143) so here's how to do it. Go to the Direct Editor and load the ISClrWrap table. In that table, add a row with the name of your custom action, Dependency0, and the build-time path to your dependency DLL as the three columns. For example, if you were using the InstallShield.Interop.Msi.dll, you might specify (with | characters separating the columns):

[ MyManagedCA | Dependency0 | <ISProductFolder>\system\InstallShield.Interop.Msi.dll ]

If you need to specify additional assemblies, add another row and increment the number to Dependency1, and so forth, being sure not to skip any numbers.

Christopher Painter
07-02-2008, 11:01 AM
As an aside, as much as I appreciate the work Acresso did on Managed CA's, DTF is a better direction to go.

1) It solves the problem of tatooing the msi process with a fixed version of the CLR
2) It's linker ( MakeSfxCa ) is more flexible for including dependencies an
3) The interop is simply better
4) The hosting process has a better debugging story
5) It's open source so it's easier to see problems and get resolutions to issues
6) It's not tied to one vendors authoring tools

sharon
07-07-2008, 05:02 AM
I tried to add reference in the IsClrWrap table to the required dll on the build machine as offered. Since I was trying to install on the same machine where the build took place, (just for the testing stage), I removed the dll from the system32 folder in order to see if the installation can be run now without the dll in this location. Installation failed to load this dll again. I would like to know your opinions regarding this scenario.
In addition, I would like to get some links on DTF, If possible.

Christopher Painter
07-07-2008, 10:44 AM
Google for "WiX DTF"

http://www.installsite.org/pages/en/msifaq/a/1044.htm

http://blogs.msdn.com/jasongin/default.aspx <- Jason wrote DTF

You can also search my blog for "DTF" and get 7 articles that reference it including some code snippets.