5

I'm using a dll to install a driver that's packaged inside the msi. When I schedule the custom-action for after InstallFinalize it succeeds, but if I schedule it either 1) after InstallFiles 2) after InstallFiles, execute=deferred, 3) after InstallFiles, execute=deferred, impersonate=no, or 4) before InstallFinalize it fails with "file not found" for the .inf file.

I've read This SO post and this page, but still don't understand how I get my driver to be installed.

If I use after InstallFinalize then if for some other reason an error is returned it's too late to abort the installation and it's botched.

Community
  • 1
  • 1
Daniel Harms
  • 1,178
  • 1
  • 11
  • 20

1 Answers1

4

According to this answer to the question you linked, you should schedule it after InstallFiles and make it deferred.

Enable verbose logging during your installation, and you'll be able to see when files are copied to the hard drive and when your custom action is called.

After InstallFinalized, your installation is already complete.

Community
  • 1
  • 1
Alexey Ivanov
  • 11,541
  • 4
  • 39
  • 68
  • I'll try again, but deferred after InstallFiles also doesn't work. I'll turn on verbose logging but so far it hasn't worked. – Daniel Harms Jul 14 '11 at 16:45
  • I've figured out the problem. If I do deferred after InstallFiles then I can't read the install directory out of the wix session in my custom action. Is there a workaround for this? – Daniel Harms Jul 14 '11 at 17:12
  • 1
    @Precision Yes, you have access to a very limited set of properties from deferred custom actions. See [Obtaining Context Information for Deferred Execution Custom Actions](http://msdn.microsoft.com/en-us/library/aa370543(v=VS.85).aspx) for more details, or search SO for _CustomActionData_. In short, you have to create property with the name of your action and set its value to whatever you need in you custom action. – Alexey Ivanov Jul 15 '11 at 17:39
  • I'll upvote this anser if you add details of your last comment, otherwise I dont understand your solution. – guiomie Dec 05 '12 at 00:46
  • @guiomie Do you mean you don't understand how to pass parameters to deferred custom action? [This answer](http://stackoverflow.com/a/11233268/572834) outlines how pass and access properties via `CustomActionData`. Another helpful example is in comments to [this answer](http://stackoverflow.com/a/7306809/572834). – Alexey Ivanov Dec 05 '12 at 07:32
  • In fact, nearly everything is done in `InstallFinalize` that isn't a check or preparation or register. This includes the file copies. Therefore, our custom actions that need the files need to be `deferred`, which means it will be executed in `InstallFinalize` also. – Nicolas May 12 '20 at 08:55