Search code examples
c#visual-studiosetup-project

Visual studio deployment project shortcut for primary output - 'Open file location' not working


When you create a shortcut to the primary output with your deployment project, following these steps:

(as per this post Visual Studio Deployment Project - Create shortcut to deployed executable)

In your Deployment Project go to File System Editor
Click on "Application Folder" (I assume you have "Primary Output" from your projects there)
Right click on "Primary Output" of the project you want to target with your shortcut - select "Create Shortcut to Primary Output ..."
Rename shortcut
Drag shortcut to Desktop / Programs Menu folder

It all works fine, BUT when you right click on the shortcut on a target machine after installation and select 'Open file location' option, which should open the folder of the actual exe, Windows open the folder where the shortcut is located. The 'Open target location' button in 'Properties' of the shortcut is disabled.

Any idea why is it not linked properly, even though clicking on it launches the executable all OK?


Solution

  • Shortcuts installed by MSI are by default advertised shortcuts. It just means that the shortcut is an indirect pointer to its target, containing Windows Installer ProductCode, Feature name and Component guid. As part of the activation it checks that the target file is present, and if it's not it will cause a repair of the installed product.

    If you set DISABLEADVTSHORTCUTS to 1 on the command line install or manually add it to the Property table of the MSI file (InstEd or Orca) this will disable creating them. https://msdn.microsoft.com/en-us/library/aa368297(v=vs.85).aspx