70

I realize there is likely a simple method to do this but how does one create a desktop shortcut to the executable deployed by an MSI built using a Visual Studio Deployment project?

I imagine I need to use the Filesystem editor but when I create shortcut on the user's desktop I can't target the executable. I can only specify the target as the application folder not the specific executable.

MPelletier
  • 16,256
  • 15
  • 86
  • 137
Fred Strauss
  • 1,435
  • 2
  • 13
  • 21

6 Answers6

148

After wasting an hour, I got it done - VS 2010 ... VS 2017 (this article helped):

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

That's it!

Matt
  • 25,467
  • 18
  • 120
  • 187
roman m
  • 26,012
  • 31
  • 101
  • 133
  • 1
    Good for VS 2013 too with new project extensions (that M.S. revived from the dead) – Tim Sep 23 '14 at 13:57
  • Thanks its very easy. – Gaurav123 Sep 26 '14 at 06:11
  • 8
    When you click the shortcut in the menu does it open the folder location where the application resides or does it run the app? I've found this just opens the folder. – user1040975 May 14 '15 at 19:13
  • 1
    Yep, works for 2015 too! I wasted a few hours creating a shortcut in the User's Program Menu and then having the build fail! Adding it to the target then dragging it to the program folder worked (makes you wonder why there is a context menu to add a shortcut to the folder if that results in a build fail). – Nepaluz Feb 07 '17 at 13:40
  • 2
    Works for 2017 too. – yazanpro Jul 17 '18 at 20:06
  • I have tried the same steps you have mentioned. VS2019 - setup project but the shortcut target is always pointing to the source MSI somehow. Verified the shortcut properties after generation. Even the field "Target" is in disabled state. Any help would be appreciated. – Arjun Natarajan Mar 15 '23 at 11:49
61

I would add the following steps (to roman m's answer) to get the .exe's icon into the shortcut, because it seems that by default you will get an ugly generic document-shortcut icon.

Assuming you have already given your program the desired icon,

  • right-click on the Deployment Project
  • pick menu item View > File System
  • in the File System window, find the shortuct whose icon you want to change (for example, under "Users's Programs Menu")
  • go to the shortcut's Properties (right-click and pick "Properties Window")
  • go to Icon
  • Browse...
  • change "Files of type" to *.exe
  • browse to and select your "primary output"
  • OK, OK
Jeff Roe
  • 3,147
  • 32
  • 45
  • 5
    The only thing I wanted to add is that it worked with icon size of 64x64 but not 256x256. – user523234 Feb 23 '12 at 15:45
  • That does not work for the app running in system tray... app itself has an icon, but when selecting icon/browse - inside the output folder (it has dlls and exe) it does not list any files at all if select *.exe, and if select *.dll - it shows only "primary output from myproj (active)" – Sasha Bond May 21 '20 at 19:21
4

Should be quite simple:

  • Open FileSystem editor and go the User's Desktop folder.
  • Right click with the mouse and select Create New Shortcut.
  • You will be presented with a dialog that allows you to select for instance the application folder (on the target machine). When you double click on this you see what is inside that folder.
  • Now simply select the primary project output that "contains" your exe file.

Likewise you can set the icon of the shortcut. At least I believe so.

Community
  • 1
  • 1
Stefan Egli
  • 17,398
  • 3
  • 54
  • 75
3

I resolved this error by using a 64 x 64 icon

1

wondering if any of you have actually used visual studio? when you add a primary output and right click it, theres no option to add a shortcut. if you create a shortcut, you cant select primary output as an option. the option simply is not there

0

icon file size is important, 75 KB is not showed in shortcut exe file, but 15 KB is showed.

Kemal Duran
  • 1,478
  • 1
  • 13
  • 19