Creating Short= cuts in setup projects

Saturday, April 21, 2007


Problem: A Visual studio 2005 setup project was creating shortcuts in my SendTo folder but these weren't showing up in my context folder when I right clicked Send To.

  • Visual Studio automatic ally creates "advertised shortcuts". This shortcuts launch the Windows Installer to check whether components are installed before cal ling the shortcut.
  • "Advertised shortcuts" will not work for the SendTo folder.
  • Advertised shortcuts an d the SendTo folder

 

Solution: Creating Non-advertised shortcu ts. We need to tell the windows installer to not disable advertised shortcuts. This will cause it to create regular shortcuts instead. We can do this several w ays.

  1. At the command line
    1. When running the setup executable pass a command li ne option to disable advertised shortcuts.

"setup.exe DISABLEADVTSHORTCUTS"

  1. Modify the .MSI file created by the visual studio se tup project
    1. Use Microsoft's ORCA tool
      • This is provided as p art of the "Windows Installer SDK" which is part of the "Win dows Platform SDK"
      • After installing the Platform SDK you actually have to install ORCA. Its setup file will  be in the directory where the Platform SDK was installed.
      • Run ORCA and open the MSI file
      • Select the table "Property"
      • Add a row to the "Property" table with the following values for the columns
        • Property: DISABLEADVTSHORTCUTS
        • Value: 1
    1. Create a post build event of our setup project to automatically insert and set the property DISABLEADVTSHORTCUTS in our MSI file
      • Microsoft provides the script "WiRunSQL.vbs" with the windows installer SDK
      • This script allows yo u to programmatically modify the MSI file
      1. Create a post build event for your SetupProject
        • Thi s is different then for regular projects
        1. Highlight  your project in solution explorer
        2. Select its properties - this will bring up the property window

visual studio prop menu

  1. Click on ".." and enter the following com mand to run the script which will automatically insert and set DISABLEADVTSHORTCUTS in the msi file

cscrit //nologo "..\WiRunSql.vbs" "$(BuiltOuputPath)" "IN SERT INTO Property(Property, Value) VALUES ('DISABLEADVTSHORTCUTS', '1')"

  1. You will need to adjust the path to WiRunSql.vbs
  2. My suggestion is to add WiRunSql.vbs to your SetupProject folder (i.e the folder containing the Debug and Release folders)
    • The working directory  for the post build event is the "Debug" or "Release" folder
    • So using "..\WiRunSql.vbs" points to the directory above it.

 

 

 References:

Crea ting post build Events for deployment projects

Shortcut Installation