WiX dual-purpose .msi package won’t create system-wide start menu shortcuts

Summary

The issue at hand is related to creating a dual-purpose .msi package using WiX that can be installed either in the per-user or per-machine context. The package is set to perUserOrMachine, which sets ALLUSERS=2 and MSINSTALLPERUSER=1. However, when trying to create system-wide start menu shortcuts, they are always created in a subdirectory of C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs, instead of C:\ProgramData\Microsoft\Windows\Start Menu\ as expected.

Root Cause

The root cause of this issue is due to the following reasons:

  • MSINSTALLPERUSER setting is not being respected when creating shortcuts
  • ALLUSERS setting is not being applied correctly
  • WiX or Windows Installer might be silently redirecting the shortcut creation

Why This Happens in Real Systems

This issue occurs in real systems because of the complexity of Windows Installer and WiX interactions. The perUserOrMachine package scope can lead to unexpected behavior when dealing with system-wide shortcuts. The reasons for this behavior include:

  • Security restrictions on creating system-wide shortcuts
  • Installer limitations in handling perUserOrMachine packages
  • Conflicting settings between ALLUSERS and MSINSTALLPERUSER

Real-World Impact

The impact of this issue is significant, as it affects the usability and functionality of the installed application. The system-wide shortcuts are not created as expected, leading to:

  • User confusion and frustration
  • Limited accessibility to the application
  • Potential security risks due to incorrect shortcut creation

Example or Code



  
  

This code snippet demonstrates the WiX configuration for creating a dual-purpose package with system-wide shortcuts.

How Senior Engineers Fix It

Senior engineers can fix this issue by:

  • Carefully reviewing the WiX configuration and Windows Installer settings
  • Testing the installation with different ALLUSERS and MSINSTALLPERUSER settings
  • Using custom actions or scripts to create system-wide shortcuts if necessary
  • Consulting the WiX and Windows Installer documentation for best practices and known issues

Why Juniors Miss It

Junior engineers may miss this issue due to:

  • Lack of experience with WiX and Windows Installer
  • Insufficient understanding of perUserOrMachine packages and system-wide shortcuts
  • Overlooking the importance of testing with different ALLUSERS and MSINSTALLPERUSER settings
  • Not consulting the WiX and Windows Installer documentation for best practices and known issues

Leave a Comment