Wix component won't update when patched - wix

I'm creating a patch that will update my MSI built in WiX. I have one component that only has a sqlupdatescript that handles all my database changes.
When I need to update my db I add another sqlscript in that component. The problem is that if I create a patch that ONLY has an added sqlscript in that component the patch won't do anything. If I make a change in a file (within the same feature) the sqlscript will also run.
Is this expected behavior in WiX?

Windows Installer detects the changes by the changes in the resource marked as KeyPath. It can be file or registry key, for instance. I suppose your component contains a single file, which automatically makes it a key path. Thus, when you change only a script, the file doesn't change, and Windows Installer doesn't know that something was changed. Otherwise, it correctly detects the change and applies the patch.

Related

WiX optional Section Content

I am trying to write a simple windows installer that has to write some fields in a .ini file if a feature is enabled. On the lower level, this is if a specific property is set from a checkbox.
I have been googling for days, but neither the internet nor the docs seem to be of help. Can anyone point me in the right direction regarding having optional fields in a section?
All changes to resources on the machine (dir,file,reg,ini and so on) are associated with components. Components are associated to features. So if a feature is being installed, the component is being installed and therefore the resource is being installed.
So you nest an IniFile element underneath a Component element.
https://wixtoolset.org/docs/v3/xsd/wix/inifile/
Checkboxes controll a property. Checked it has a value you specify. Unchecked it has no value.
There's also a little problem that Windows Installer doesn't remember property values for subsequent transactions and that the IniLocator table can only read ini files from the Windows folder.
You might want to store this value in a registry key also that way you can read it back in as part of the remember pattern.
Find my email address and hit me up. I'd be happy to walk you through it as an excercise.

Auto select License Agreement checkbox (or hide it)

I made an installer using wix burn.
I used the standard bootstrapper with Hyperlink license theme.
I don't want to display the EULA checkbox on upgrades. Once accepted one time, I don't want to show it again, or at least auto select it.
To achieve that, I customized the bafunctions.dll and wrote some code in OnDetect(). After a given condition is match, I set the variable EulaAcceptCheckbox = 1. I know that this is the variable name corresponding to the EULA checkbox because I inspected the log of the installer before making this changes.
After making all the modifications, I know my logic is working because I see the following lines in the log:
[1510:1410][2015-11-17T19:01:04]i000: Running detect complete BA function
[1510:1410][2015-11-17T19:01:04]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
But the checkbox is not displayed as checked. I tried to set 'EulaAcceptCheckbox' in OnDetect() and also in OnDetectComplete(): no luck.
I also tried to set LicenseUrl="" and WixStdbaLicenseUrl="" but that does not work either.
I have already used bafunctions.dll to do some checkbox customization in another installer. It seems not to work with the EULA checkbox only. What's wrong with my approach?
There seems to be no solution for this.

WiX 3.7: How to add or update a dialog during uninstall?

I need to add a dialog box that would pop up during complete uninstall (not major upgrade) right after the confirmation ("Are you sure you want to uninstall this product?") dialog. This dialog would prompt the user to answer a question and based on the response, set up a property that would be used in the condition for the RemoveRegistryKey element (i.e. it will remove a registry key only if the user selects an option to delete the key).
I have an idea how to add a dialog to the install sequence (I am using a modified WixUI_InstalLDir sequence to which I added a custom dialog I need during installation), but I can't find any references that would explain how to add a custom dialog to an uninstall sequence. It would be even better if I could modify the uninstall confirmation dialog, so the user would see one dialog instead of two. An the key thing would be to be able to set up a property that could be used in the component condition.
Is this possible? Are there any examples how to do this?
This is against Microsoft design guidelines. Add/Remove programs calls the uninstall with a silent UI argument and the UI sequence is never processed.
The only place you can author UI during an uninstall is a "change" or "maintenance" UI experience where they select Repair | Change | Remove and on Remove do your UI. But you'd have to lock down the Remove buttom and force them through this path. Also realize they could call msiexec /x /qb from the command line.
Bottom line is Microsoft made this choice to make the uninstall process simple and easy for the user. As for removing the registry key, Microsoft would say that you should leave user data on uninstall.

Can we localize WIX msi and bundle using language selection UI at runtime?

We have an MSI and Bundle created in Wix. I need to localize both of these in such a way that language selection GUI will be popped-up and language can be selected by the user at run time. Would be really appreciated if anybody can help me on this.
For MSI, i am working on creating another bootstapper for bringing-up with language selection combobox and invoke the tranfomed MSI with the required transform(using command shell). I am still not sure about the feasibilty of this approach. I am facing issue in creating combo box in customized UI of bootstapper and invoking batch command to run this msi in the required language.
For Bundle - I am still working on finding a method. if anybody has any idea/samples for this.
It will be helpful if anybody can help me with this issue or provide me with an another alternative method to meet above requirement.
Thanks,
The recommended method (and for that matter, the method used by most MS products), is as you describe.
Create an MSI localized for each language
pick a base and generate MST's
Package the MSTs, the MSI and the bootstrapper, which will
present the language selection dialog and call MSIEXEC, passing TRANSFORM=language.mst as an argument
After the MSIEXEC process has started, all localization is finalized, so to speak. Any selection must go on outside the MSI system.
See this codeproject article for an example.
I guess this may help you:
creating language selection dialog using WiX.
there is a limitation that custom UI for language selection is created using C# based custom bootstrapper. This may lead to the requirement of .Net framework on host machine.
UI selection for MSI
Create an MSI localized for each language
Pick a base and generate MST's
Package the MSTs, the MSI into a bootstrapper.
Customize the HyperlinkTheme.xml to include radio button for selecting each language.
Use the Variable tag to link radio button from UI to .wxs file
Include the msi property in the msi tag and hard code the path to MST's and InstallCondition attribute to differentiate each selection
Use the latest version of wix for this feature support.
Bundle support only automatic base detection there is no support for UI selection

WIX RemoveFolder issue

I am trying to add a feature to my msi based installer, written in wix, which will allow the user to change the name of the folder that keeps the shortcuts within the Windows start menu.
What I did so far is to add a folder there (with a static name), add shortcuts to that folder and remove all of them during uninstall (by using the RemoveFolder tag). Then I added a custom action that will pick up the property that is set from an edit box in UI and set that as the name of the folder, something like:
By running this within the InstallExecuteSequence, the folder is created correctly (with the name the user set for it) and all things are set into place. However, when I uninstall the product, the folder remains with all of it's shortcuts in it (that point to nothing now and they ask for deletion when you click them).
Is there any way to remove a folder that I dynamically changed it's Name attribute during installation, as described above?
Thanks.
You'll need to save the dynamic property to the registry, and read it back during maintenance/repair/uninstall. Windows Installer doesn't "remember" property changes, you need to do it yourself.