WIX RemoveFolder issue - wix

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.

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.

Write in registry in order to add application in start menu

I have made a program in Visual Basic and I want to add this program in user's start menu by code. How can I do that?
I know that there is a folder in
C:\ProgramData\Microsoft\Windows\Start Menu\Programs
where I can add my application's shortcut, but I think I have, also, to write in user's registry.
And that's my problem: I don't know what to write in registry in order to add app in start menu. A simple location in registry will help me if you don't know vb code.

Wix component won't update when patched

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.

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.

how do i change default sources folder in Netbeans 7.1.2

Does anybody know how to change the default sources folder in Netbeans 7.1.2
I've looked through the files but can't seem to locate where the default directory is stored - I have been through the forums but can't find anything useful..?
currently C:\Users\wayne\Documents\NetBeansProjects\PhpProject7
I have read that if you select a different directory then that becomes the default - this is not the case on my installation
Thanks
If you are using Windows 7 or vista, you are gonna find it here C:\Users\YourUserName\AppData\Roaming\NetBeans\7.1.2\config\Preferences\org\netbeans\modules\projectui.properties.
However if you you are using windowsXP remember the USERPROFILE enviromental variable is not Users but rather Documents and Settings. Enviromental variables change depending on the operating system you are using. To know whats the USERPROFILE variable for yours just open a command prompt window and type SET USERPROFILE. Or you can simply type %USERPROFILE%\AppData\Roaming\NetBeans\$ENTER_YOUR_NETBEANS_VERSION_NUMBER_HERE\config\Preferences\org\netbeans\modules\projectui.properties and that will send you to the correct directory.
It's actually pretty simple.
"C:\Users\wayne\.netbeans\7.1.2\config\Preferences\org\netbeans\modules there is a file called projectui"
is right on the money, but he forgot one detail that you need to keep in mind for changing the directory. If you want to set the default project folder to (in my case):
"C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\docroot"
then you have to double the slashes. Instead of the above link you have to put:
"C:\\Program Files\\glassfish-3.1.2.2\\glassfish\\domains\\domain1\\docroot"
without spaces. I had it that way originally but it hid one of each of them.
In newer versions, right-click on the project you want to move in the 'Projects' tab, and then click 'Move'. This will allow you to move the project to a new directory.
Tip! I found (on Windows 7) that the AppData folder is hidden, so doesn't appear in windows explorer files by default .
To make it visible, open a window for the USERPROFILE directory as above, and use
Organize ->
Folder and Search Options ->
View (tab) ->
Advanced settings list ->
Hidden files and folders radio button to show them.
(Or you can open it via search or run if you type it right)
I hope that saves you the several hours it cost me...