How do I set AppUserModelID on shortcut?

Clyde picture Clyde · May 12, 2010 · Viewed 9.2k times · Source

I'm in Windows 7 working on combining two apps with the same task bar icon, as described in this question:

Pinning advertised shortcuts on the taskbar in windows 7

I see there, and it lots of online documentation that I need to set the AppUserModelID as a property of the shortcut. My installer program uses the basic Visual Studio 2008 setup project, and I don't see any way to set shortcut properties on installation. Is there any head-start anyone can give me on how to do this?

Answer

Olly picture Olly · Jan 10, 2012

Sheng commented that "You can also switch to other MSI authoring tools that supports setting the appid for shortcuts, such as WIX or NSIS."

To achieve this using a Shortcut element in Wix you must add a child ShortcutProperty element to your Shortcut element and use the Shell property name "System.AppUserModel.ID" as the key.

    <Shortcut Id="StartMenuShortcut"
              Name="Shortcut Name"
              Description="Shortcut Description"
              Target="[INSTALLLOCATION]Application.exe"
              WorkingDirectory="INSTALLLOCATION">
      <ShortcutProperty Key="System.AppUserModel.ID" Value="AppUserModelID" />
    </Shortcut>