We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Florent
Posts: 1
Joined: Tue Mar 04, 2014 11:58 pm

Passing Session to WiX Toolkit Custom Actions

I'm hoping to convert a PowerShell script to a C# Custom Action so that can access the session and send messages back to it to update the install status to the user.

The guide at http://www.advancedinstaller.com/user-g ... rp-ca.html is out of date, as acknowledged here: http://www.advancedinstaller.com/forums ... 940#p64070

However, what is the correct way to add the DLL if I want to be able to access the session data like in the tutorial? I don't just want to pass properties to the DLL methods--I want a full Microsoft.Deployment.WindowsInstaller.Session to be passed in like in the tutorial. That way, I can call session.Message to update the install progress display message, etc.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Passing Session to WiX Toolkit Custom Actions

Hi Florent,

I'm afraid you misunderstood my colleague's reply from the post you linked. There he said the sample code we have published does not match the scenario
for that specific user. However, the custom action demoed there it still correctly defined.

The main condition to access the "Session" object is to schedule the custom action as immediate. As my colleague explained it is better to be added as an attached custom action, so the binary file is included directly in the MSI and available at all times, not in the list of files that the MSI should install.

In our example it is shown how you use the Session object to get and set a property, this means that your custom action has access to the entire Session of the installation, so you should be able to use the desired API.

In the following forums post I also demoed how to update the action text and progress bar during the installation using a C# DTF custom action.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”