Q:

Wix - copy file based on combobox property

When installing an application using Wix, I would like to copy a file to a location based on a ComboBox property then a PushButton with <Publish Event="DoAction" Value="CustomAction">1</Publish>. 
If I use a Custom Action for this and set Execute="immediate", then the file copy fails with the error UnauthorizedAccessException was unhandled by user code.
If I set Execute="deferred" Impersonate="no" in the Custom Action, and add it to InstallExecuteSequence, then it runs too early, before a value is set for the ComboBox property, and it fails.
Is there any way that I can get a deferred Custom Action which will only run when a value is selected in the ComboBox and the button is pushed?

A:

One way of getting this to work with Execute="immediate" is to open the command prompt as administrator and run the msi from there. This grants sufficient privileges to copy files.

