1

I've had at least two users complain about our myapp.msi quickly failing, rolling back and then exiting without any messages. This just got reported again by an internal tester running Windows 11 (I don't recall whether the first user was on Windows 10 or 11).

In both cases, the cause was a missing C:\Users\<logon>\Desktop folder -- our installer creates a desktop shortcut for our app, and failed due to the expected directory not being present. On both users' machine, the "Desktop" folder was located in C:\Users\<logon>\OneDrive\Desktop, instead. If I instruct the user to create an empty folder "C:\Users\<logon>\Desktop", and then re-run our install, it runs to completion.

I know Windows allows users to change the location of special folders like Desktop, Documents, Downloads, etc. Though I don't use OneDrive personally, it makes sense to me that OneDrive would move many of these folders under C:\Users\<logon>\OneDrive so that they'd be backed up and accessible from multiple systems.

The part I don't understand is why WiX apparently isn't getting the actual Desktop special-folder location from the OS, and instead seems to be using a hard-coded default of some kind.

I'm using the standard pattern to create our Desktop shortcut:

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
             . . .
        <Directory Id="DesktopFolder"/>
             . . .
    </Directory>
</Fragment>

<Fragment>
    <DirectoryRef Id="DesktopFolder">
        <Component Id="cmp_DesktopShortcut" Guid="...">
            <Shortcut Id="shortcut_Desktop"
                      Name="MyApp"                 
                      Description="Start the MyApp application"                 
                      Target="[INSTALLFOLDER]MyApp.exe"                 
                      WorkingDirectory="INSTALLFOLDER" />
            <RegistryValue Root="HKCU"
                           Key="Software\MyCompany\MyApp"
                           Name="InstalledDesktopShortcut"
                           Type="integer"
                           Value="1"
                           KeyPath="yes" />
        </Component>
    </DirectoryRef>
</Fragment>

My Google-Fu has failed me on this -- I couldn't find any reports about this issue. Can anyone provide any insight?

Scott Smith
  • 3,900
  • 2
  • 31
  • 63

0 Answers0