Windows Installer : SpawnAndWaitDialog not getting closed automatically? - wix

I am using a C# custom action followed by a SpawnAndWait Dialog.
Something Like
PROPERTY WORK_DONE="False"
1.LaunchCustomAction (This does some work and sets WORK_DONE to True)
2.Show SpawnAndWait (Exit when WORK_DONE="True")
Problem,For SpawnAndWait Dialog to Appear, I need to mark my CustomAction as
asynchronous, that is to continue installation without waiting for the custom action to finish. But Whenever I do this, Properties are not getting updated and as a result SpawnAndWait Dialog doesn't get closed automatically.
If I don't mark my Condition as async, The dialog doesn't appear and it waits for the custom action to finish first.
My Requirement is to Show a small popup window that lets the user know that there is a background task going on, Please wait.
Please let me know what am I doing wrong.
I am using C# custom Action via Wix Toolset to build the custom action and AdvancedInstaller to build the installer.

I would highly recommend you (if you are willing to) to write your custom action as an unmanaged custom action written in native C++ and use the MsiSetProperty function to set your property. There are lots of Windows Installer incompatibilities and limitations in what regards its integration with managed custom actions.
If you still need to use a managed C# custom action please try to add your custom action as a custom action with sequence in Advanced Installer if this configuration is suitable for your scenario.

Related

Wix / WixSharp installer. Track user cancel installation event

I'm developing the installer using WixSharp. I want to track (catch, subscribe etc) the event when user clicks the cancel button (cancel / abort installation).
I want to track during the stage user inputs the data and during the installation files process as well. It's better no changing the standard UI dialogs but using custom action or something. But if changing UI is the only way it's OK.
The project UI type is WixUI_InstallDir.
Thanks for attention.
You can't track this button click if you use this project type. But you can customize this project type if you adds this dialogs forms in your project
WixSharp Managed Setup - Cusom UI
Just add dialogs from this project and cancel handler (i think you know how to do it in winforms). Don't forget to check Project.cs, there are dialogs sequence and ManagedUI parameter set.

MSI: Show message box in UI phase of installation

I'm updating an InstallShield based installer. I've added a new managed custom action, written in C#, and packaged using Wix DTF.
Action is invoked correctly, and performs necessary actions.
Problem I have is showing an error message to user.
Method 1: MsiProcessMessage
From articles I've read, I understood that MsiProcessMessage is the correct way to do it, however this method does not work in UI sequence (before setup actually starts copying files and modifying system). In install sequence this method works. Code which I use is following:
Record record = new Record() { FormatString = "Password is not valid for this user." };
session.Message(
InstallMessage.Error | (InstallMessage)(MessageBoxIcon.Error) | (InstallMessage)MessageBoxButtons.OK,
record
);
Is it actually impossible to show an error message in UI sequence (Immediate execution) using MsiProcessMessage?
Method 2: MessageBox.Show
Using Windows.Forms works for showing a message box. However, message is displayed in background of setup wizard, and shows a separate icon in Windows taskbar.
Is there a way to get window handle of installation wizard, and that way solve this problem?
You didn't quite mention this, but I'm guessing that you are invoking your custom action off a DoAction ControlEvent, published off of something like a button click. Underneath the covers, this is very different from scheduling it in the InstallUISequence. MsiProcessMessage doesn't work from DoAction.
For proper integration with the Windows Installer UI experience, you should avoid using MessageBox.Show (your method 2). Better-integrated options include:
Tweaking a message that can be shown on the dialog from which you invoke this action
Showing a popup message by conditionally invoking a SpawnDialog ControlEvent
Showing an additional wizard panel by conditionally invoking a NewDialog ControlEvent
All three of those involve editing the UI of your project, but differently.

How to add custom action to the 'close' event after successful installation

I have two msis and packed them into a bootstrapper EXE installer. But I want to have the ability to launch the application after installation. I know there's a way to achieve this by adding a 'launch' button. Then there will be two buttons when the installation succeeded. But is there a way to add a custom action to the 'close' button or remove the 'close' button?
Thanks!
Wix Burn UI is not a powerful for now, as far I know, however you can do anything you want, it's just matter of time you're willing to put in. Burn UI does not play well with properties for now, you can't even create custom TextBox to fill up a property, but if time is not a problem:
1) You can download Wix source, and modify everything the way you want it to be, making it reusable.
2) You can create custom WiX Burn UI(I like WPF+MVVM), which shouldn't take too much time, and should be very interesting. There you can include anything your soul wants.
3) You can disable WIx BURN UI and use MSI internalUI,
this is good example; http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html
That will allow you to configfure everything, such as "Close" button having a custom action. + removing Close button by overriding custom dialogs(you can download them from wix, *.THM files)
No, neither of those is possible.

bootstrapper application rollback

I am trying to create a Wix burn bootstrapper that installs my msi. The bootstrapper exe is working fine but the only issue is that whenever I try to cancel the installation in midway the custom actions which are added in msi is not get stopping. Can anyone tell how to stop and rollback the installation while clicking cancel button. Thanks in advance.
A custom action must send ::MsiProcessMessage() calls to provide the possiblity to recieve the cancel and handle the return code from that API (usually ERROR_INSTALL_USEREXIT or IDCANCEL). Then the custom action must exit.
If you look at some of the WiX standard custom actions you'll see lots calls to WcaProcessMessage() and such. We save the return code from those and WcaFinalize() returns the correct thing on exit. Check out src\ca\wcautil\wcautil.cpp and src\ca\wcautil\wcawrap.cpp for example code.

wix uninstall dialog properties not updating

I am launching a custom dialog in my uninstall sequence to gather a handful of data items from the user ultimately to run a custom action to undo an install time custom action. unfortunately none of the property values from the UI are being updated...? They are all blank when I get to my custom action code.
I have read most of the related posts on the web, and I understand not many people are doing uninstall dialogs, being that it will not show in the add/remove version of the uninstaller, and the possibility of getting around this using the ARPNOREMOVE, etc...
Considering I do want to use the uninstall dialog, why aren't the properties being updated? I added the dialog to the install time sequence and the properties are there in the custom action, so I don't believe it is a configuration problem with my dialog or properties. What is different about the UI -properties in the uninstall?
There could be a number of problems:
The properties are not public (app caps names). Only public properties are passes to the execution phase of the installation. More details here.
Your custom action runs deferred and it does't have access to the installation context. More details here on how to access context data from a deferred ca.