2

I created a managed CustomAction to copy 2 files not included in the *.MSI to the installation directory.

While this works in Windows XP, it fails in Windows 7. Although the log say the files are copied to the desired location, C:\Program Files\MyApp\, they are actually copied to C:\Users\MyUser\AppData\Local\VirtualStore\Program Files (x86)\MyApp\. My guess is that this has to do with access rights to modify the program folder.

This is how I call the custom action in WiX:

<CustomAction Id='InstallSource' BinaryKey='SrcInstActionDll' DllEntry='InstallSourceFiles' Execute='deferred' Impersonate='no'/> <CustomAction Id="InstallSource.SetProperty" Return="check" Property="InstallSource" Value='Files=[SourceDir]$(var.SourceZipName),[SourceDir]$(var.SymbolsZipName);TargetDir=[ParentFolder]' Execute='immediate'/> 

The CustomAction itself simply invokes File.Copy(). Other files copied by the installer work perfectly in Windows 7. Only those files copied using the CustomAction have the described problem.

2 Answers 2

2

Indeed this behavior is caused by the file system redirection triggered when a 32 bit app (in a 64 bits Windows) running as an standard user tries to write to some privileged folder.

For me it looks like your custom action is not running elevated. Since the custom action definition looks correct the question that remains is where you are firing this custom action.

Since you mention the log I assume you are running msiexec and checking the logs. Make sure that your custom action runs after a line that looks like:

MSI (s) (BC:70) [13:34:10:669]: MSI_LUA: Elevation required to install product, will prompt for credentials MSI (s) (BC:70) [13:34:59:528]: MSI_LUA: Credential Request return = 0x0 MSI (s) (BC:70) [13:34:59:528]: MSI_LUA: Elevated credential consent provided. Install will run elevated 

Some time ago I had a similar issue with custom actions and this blog post helped me to figure out how to fix it. This is another post that I think may help

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

0

Like you said, I think that your Custom Action needs elevation. Since your CA is a .Net project, it's kind of eassy to set it up to support elevation.

Please check the next link, it has a good explanation on how to handdle UAC on a .Net project.

enabling-your-application-for-uac-on-vista

Hope it helps.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.