WiX Setup project programmenu shortcut without uninstall option - wix

I have set up a wix set up project that produces my application's msi installer. I have created a desktop shortcut and a program menu shortcut. In order to have the program menu shortcut, I have to specify a RemoveFolder element in the shortcut component which essentially creates an uninstall shortcut with it.
My question is, is there a way to create the program menu shortcut without having the uninstall shortcut? I would like the user to uninstall from going to the add/remove programs in the Control Panel.
I can simply not add the programmenu shortcut, but then the only way to use my application is via the desktop shortcut. It would not be a good user experience if they cannot find the application through the start/program menu. Thus I want to have a program menu shortcut but without the uninstall shortcut.
Any help would be appreciated.

I realise that this was a very stupid question to ask in the first place. All I had to do was remove one line of code.
<!-- Start Menu Shortcut-->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="PUT-GUID-HERE">
<Shortcut Id="ApplicationStartMenuShortcut" Name="devapp" Description="My Application" Target="[#devapp.exe]" WorkingDirectory="APPLICATIONROOTDIRECTORY" />
<!-- Uncomment the line below to have an uninstall shortcut in the program menu. -->
<!--<Shortcut Id="UninstallProduct" Name="Uninstall devapp" Description="Uninstalls devapp" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" />-->
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\CompanyName\ApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>

Related

How to keep taskbar shortcut during update?

I have the following situation.
My product installs the binaries inside c:\Program Files (x86)\MyCompany\MyApp\ and a shortcut under C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MyCompany.
I build the msi using this great example: https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/
I just added the following piece of code
<!-- ApplicationShortcut-->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="!(loc.ManufacturerName)">
<Component Id="ApplicationShortcut" Guid="F4B7EAFA-FF19-41B4-8267-3AEFC12235A7">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="!(loc.ApplicationName)"
Description="!(loc.ProductDescription)"
Target="[INSTALLDIR]MyApp.exe"
WorkingDirectory="INSTALLDIR"
/>
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\!(loc.ManufacturerName)\!(loc.ApplicationName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
The problem is the following
I install the application the fist time, it will install the shortcut just fine
Now I start the app and choose Pin to taskbar, this will create a shortcut inC:\Users\\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar`
If I rebuild the msi and execute the setup again, the taskbar shortcut is not clickable anymore, because the shortcut in C:\Users\<user>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar is missing
Is it possible to maintain the taskbar shortcut during an update?
I found the answer here: https://stackoverflow.com/a/33402698/98491
<InstallExecuteSequence>
<RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
</InstallExecuteSequence>
This prevents shortcuts from being uninstalled during an update.
As described in the comments, the disadvantage is that, after uninstall, the TaskBarShortCut remains, but that is something that a user might expect. Having to recreate a pinned taskbar shortcut everytime he updates a software is not.

WiX Installer removes shortcut on upgrade

I am using the WiX Toolkit v3.11 for creating setups of my software. During installation I create startmenu shortcuts with the following code:
<Shortcut Id='startmenuMyProgram'
Name='$(var.MyProgramName)'
Directory='ProgramMenuFolder'
WorkingDirectory='APPLICATIONFOLDER'
Advertise='yes'
Icon='icon.exe'>
<Icon Id='icon.exe' SourceFile='$(var.Setuppath)\MyProgram.exe'/>
</Shortcut>
In this way I also create two shortcuts for other executables. Now for the uninstall I want to remove the shortcuts.
<Component Id="removeStartmenuShortcuts" Guid="803ad14a-feab-4901-b9db-2c4a1298ae8b">
<Condition>(REMOVE=ALL) AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE)</Condition>
<RemoveFile Id="remove_startmenuProgram1" Name="startmenuMyProgram" On="uninstall" />
<RemoveFile Id="remove_startmenuProgram2" Name="startmenuMyProgram2" On="uninstall"/>
<RemoveFile Id="remove_startmenuProgram3" Name="startmenuMyProgram3" On="uninstall"/>
</Component>
This works without any problems when I uninstall the software. But the shortcuts are also removed when an update is performed. But I want to prevent this behavior, but the condition seems not to work. So all shortcuts like in the Windows task bar are removed when I do an update.
How can I make my update progress work correctly?
Here the behavior after update:
The group with all shortcuts in the right is missing!
You can combine the 2 component. By this you will not need to use condition statements.
The registry value is to set a keypath under component.
<Component Id="cmpstartmenuMyProgram" Guid="{67CB4F7A-5028-4697-A47F-DE99110B9645}">
<Shortcut Id="Shortcut.ApplicationName"
Name="ApplicationName"
Target="[INSTALLDIR]ApplicationName.exe"
WorkingDirectory="INSTALLDIR"
Directory="StartMenuFolder"
Icon="Icon.exe"/>
<RemoveFile Id="RemoveStartMenuShortcut.ApplicationName" Name="ApplicationName" Directory="StartMenuFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Compony\ComponyName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>

WIX Windows 8.1 Pin to Start Screen

I need some help with getting my WIX installer to place a shortcut as a tile in the Windows 8.1 Start Screen.
So far I have tried the following code (just extending the start menu shortcut to experiment) which is not adding it to the Start Screen:
<Component Id="SomeStartMenuShortcut" Guid="{E06506E8-21F7-421C-8088-3810E0DC04D2}">
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
<Shortcut Id="SomeStartMenuShortcut" Name="SomeApp" Target="[INSTALL]SomeApp.exe" WorkingDirectory="INSTALL">
<ShortcutProperty Key="System.AppUserModel.ID" Value="SomeApp.exe" />
<ShortcutProperty Key="{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 12" Value="2" />
</Shortcut>
<RegistryValue Root="HKCU" Key="Software\SomeCompany\SomeApp" Name="StartMenuShortcut" Type="integer" Value="1" KeyPath="yes"/>
<RemoveFolder Id="SomeStartMenuShortcut" On="uninstall"/>
</Component>
From the following research:
http://wyrdfish.wordpress.com/2013/02/05/shortcuts-as-tiles-on-windows-8/
http://blogs.msdn.com/b/windows_installer_team/archive/2009/09/02/windows-7-taskbar-support-with-the-msishortcutproperty-table.aspx
Although I am now beginning to suspect that this may only be responsible for allowing a shortcut to display Pin to Start & Pin to Taskbar as options on its context menu...
Any help would be greatly appreciated!
You can't pin to start menu. Only windows or the user can. You only can decide what shortcuts NOT to display on the start menu.
I remember in one of building windows 8 blog posts they said it's this way to prevent "spamming" of the start menu."

After install different versions of my application side-by-side, uninstall one version doesn't remove shortcut from program menu.

I created an installer using WIX. As part of the installation, two shortcuts (launch and uninstall) are added to "ProgramMenu->MyCompany->MyProductName".
After I install two versions of the same application side by side. I tried to use the uninstall shortcut to uninstall one version.
The uninstall removes all the files and folders for the version. But failed to remove the shortcuts. And when I click on uninstall again. The following error shows:
"This action is only valid for products that are currently installed"
Then I run the uninstall for the other version, this time both shortcuts for THAT version are removed successfully. But leave the shortcuts for the failed version stuck in "ProgramMenu->MyCompany->MyProductName" forever. I had to manually delete them.
Here is the code I use to create the shortcuts. Anything I did wrong?
<Directory Id="ProgramMenuFolder">
<Directory Id="MyCompanyShortcutDir" Name="MyCompany">
<Directory Id="MyProductShortcutDir" Name="MyProduct">
<Component Id="cmpMyProductShortcut" Guid="*">
<Shortcut Id="MyAppShortcut" Name="My App" Description="My Application" Target="[INSTALLFOLDER]MyApp.exe" />
<RemoveFolder Id="RemoveMyCompanyShortcutDir" On="uninstall" Directory="MyCompanyShortcutDir" />
<RegistryValue Root="HKCU" Key="Software\My Company\My Product\" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="cmpUninstall" Guid="*">
<Shortcut Id="UninstallShortcut" Name="Uninstall" Description="Uninstall My App"
Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode] /Lv d:\uninstall.log " Directory="MyProductShortcutDir" />
<RegistryValue Root="HKCU" Key="[Software\My Company\My Product\" Name="Uninstall" Type="integer" Value="1" KeyPath="yes" />
<RemoveFolder Id="removeShortcut" On="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
I solved this issue myself, basically two things needed:
Change the ProductCode to *, this allows side-by-side install of two versions.
Make sure the Component Guid for Shortcut to be * as well

different shortcut behavior during unattended installation

I am trying to create a Start Menu shortcut. This is the code I'm using:
<Fragment>
<SetProperty Id="MIFOLDER" Value="[INSTALLFOLDER]\MI" Before="CostFinalize"></SetProperty>
<!-- Start menu -->
<Icon Id="iconCMD" SourceFile="$(var.SharedComponents.ProjectDir)Images\Icons\cmd.ico" />
<DirectoryRef Id="STARTMENUFOLDER">
<Component Id="cmp211060161C737F50377C120FF39D7623" Guid="{E7B9FB15-4A1D-4E3E-BCDE-EB2E5638C452}" Win64="yes">
<Shortcut Id="shrtct211060161C737F50377C120FF39D7623" Name="Management Interface (MI)"
Target="[System64Folder]\cmd.exe" Icon="iconCMD" Arguments='/k "title Managment Command Line Interface (MI)"' WorkingDirectory="MIFOLDER" />
<RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\VB\Installer\$(var.ProductName)\MI"
Name="MI" Type="string" Value="$(var.VersionNumber)" KeyPath="yes" />
<RemoveFolder Id="rem211060161C737F50377C120FF39D7623" On="uninstall"/>
</Component>
</DirectoryRef>
</Fragment>
I want this shortcut to run Command Line Interface and start it in installation folder.
When running the setup normally, it indeed works fine and all well.
When I'm installing with /q (unattended), and after installation I click the shortcut, and it leads to Windows\system32 directory and not working directory. When I look at shortcut properties, I see that it set to start at \MI as SetProperty action doesn't take place.
Any help and ideas why?
InstallUISequence will be skipped in silent installation. Use Sequenceattribute to run the SetProperty action as per your requirement(both or first).