alexk
Posts: 13
Joined: Sat Jan 07, 2012 4:39 pm

.NET Wix Custom Action in "Mixed 32/64-bit..."

Hello,

a custom action dll in a "Mixed 32/64-bit matching the platform" does install, but not run in the xxx.x64.msi installer.
how can i fix this?

kind regards
alexk
Posts: 13
Joined: Sat Jan 07, 2012 4:39 pm

Re: .NET Wix Custom Action in "Mixed 32/64-bit..."

i tested a bit around and the problem is a little more delicate, than expected...

the custom action runs on x64, but it tries to write a file to "C:\Program Files\XXX"
using standart c# file functions. Under Windows 7 the written file does not land
in the expected folder (C:\Program Files\XXXX), but in a virtual store folder
(C:\Users\USERNAME\AppData\Local\VirtualStore\Program Files\XXX) because of
Windows 7 UAC, that does not allow writing to C:\Program Files without full admin privileges.
Files are virtualized to the VirtualStore automaticly.

I googled a bit and found, that this could be avoided by switching off impersonation
which runs the action with full admin privileges. But this requires one of the "...with impersonation"
options in the "Execute Options" section, where session variables are not avaiable on the other hand.

Finally i hand over all my variables with the "Action Data" option and it works so far...

Two quesions pop up:

- Schould there be an "Immediate execution with no impersonation"?
- Is there a clever way to generate a file on the fly and inject it back into the install process with a custion action, so that writing it directly is not required any more?
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: .NET Wix Custom Action in "Mixed 32/64-bit..."

Hello,
Finally i hand over all my variables with the "Action Data" option and it works so far...

This is the correct approach for your problem. You should use a deferred with no impersonation custom action which will retrieve installer properties through CustomActionData property.
- Schould there be an "Immediate execution with no impersonation"?

No, the custom actions execution options from Advanced Installer are the only ones that Windows Installer supports. Windows Installer doesn't support an "Immediate with no impersonation" execution option.
- Is there a clever way to generate a file on the fly and inject it back into the install process with a custion action, so that writing it directly is not required any more?

I'm afraid I don't fully understand what you want to achieve? Can you please give us more details or exemplify?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
alexk
Posts: 13
Joined: Sat Jan 07, 2012 4:39 pm

Re: .NET Wix Custom Action in "Mixed 32/64-bit..."

Thank you for this explanation, this clear things off!
I'm afraid I don't fully understand what you want to achieve? Can you please give us more details or exemplify?
it´s maybe more immagination than realizable i think, but an example would be:

- Create File Data in a Custom Action (may be by running a template engine over a template filling installer variables or something....)
- Write that data to a temporary file or (may be not possible) create/replace an item in an install component with that data
- Let the installer pick up and install the temporary file or component item as it would usual do with a compiled item.

the idea is just to create install resources during installing (pre-Commit) trough a placeholder component/item/file or something...

i hope this will explain better :)

all the best,
alex
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: .NET Wix Custom Action in "Mixed 32/64-bit..."

Hello Alex,

It is not necessary to insert file created with a custom action into MSI package. In order to achieve what you want you should try this:
- Add an immediate custom action which will create the new file to a desired location. The custom action should run early in the installation sequence.
- In "Files and Folders" view select folder containing the resource file which will be installed or not. Create a "File Move Operation" which will move new created file here.
- From "Organization" page condition the installation of the resource file component which will be replaced by the new created file.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
alexk
Posts: 13
Joined: Sat Jan 07, 2012 4:39 pm

Re: .NET Wix Custom Action in "Mixed 32/64-bit..."

i will try this... thank you very much :)

Return to “Building Installers”