Question

I need to encrypt the connection string in the .config file of an app that's going to be used in our labs. To do so I followed the instructions found here http://boettr.wordpress.com/2010/05/20/simple-way-to-encrypt-app-config-through-wix-3-5-and-vs2010-using-c-code/

The work great as long as I don't install the app to either the Program Files or Program Files (x86) directories. I don't get any errors but the .config file never gets encrypted either. I tried setting the impersonate flag and also setting it to run deferred but received an error when using impersonate it had to happen after InstallInitialize and before InstallFinalize. However the Custom Action will not work unless it's run after InstallFinalize.

Code from my product.wxs

<InstallExecuteSequence>
  <Custom Action="LaunchFile" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
<Fragment>
<CustomAction Id="LaunchFile" FileKey="Encryption" ExeCommand="[INSTALLDIR]"/>

I can run the encryption.exe after the install and it works but I do get the UAC warning before it actually executes. Any Help would be appreciated.

Was it helpful?

Solution

Executing after "InstallFiles" as deferred should get you the permissions you need and guarantee the file is there.

<InstallExecuteSequence>
  <Custom Action="LaunchFile" After="InstallFiles" Impersonate="no" Execute="deferred">NOT Installed</Custom>
</InstallExecuteSequence>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top