Why doesn’t the Setup Project create a valid shortcut in the Send To folder?

Windows does have a very nice feature that’s called the Send To menu in the context menu in Windows Explorer (yes the Desktop is also Windows Exporer) for files and folders. In this menu there reside a few standard options, but you can easily add one yourself. I’ve seen for example lots of developers having their favorite editor being inside the Send To menu. This is possible because most editors (I’m not aware of any that doesn’t) support the filename be passed as a first argument to open the file.

I’ve set this up in the past. It’s very easy, just go to the Send To Folder. Under XP it’s like this: C:\Documents and Settings\username\SendTo . In this folder create a short cut to an application, for example Notepad. From that moment Notepad will appear in the Send To context menu.

I’m currently working on a application that makes use of the Send To feature available in Windows. So I thought let’s do something very easy: Create a short cut in the Send To folder from within a Setup Project. And yes that was very easy. The file-system has support for the special Send To folder.

image

But sadly the shortcut, called “File Versioner”, doesn’t show up. After some investigation I found out the shortcut was in the folder, but it did not show up.

Advertised shortcuts

What’s wrong? Some more investigation was needed, and I found out that shortcuts created by the MSI are Advertised shortcuts. Those are different from the ones you create by hand.

It took me some time until I found out how to change the type of shortcuts. Some developers might already have heard about a tool called Orca. This is a tool that’s part of Windows SDK. Orca enables developers to edit the database tables that are inside of an MSI.

You can make disable Advertised Shortcuts by the following steps:

  1. Start Orca
  2. Open the MSI inside of Orca
  3. Select the table named “Property”
  4. Choose “Add row” from the menu.
  5. Give it the property name “DISABLEADVTSHORTCUTS”
  6. Give it the value “1”

This solved the issue I had. The only sad thing is: you will have to apply this change every build of the MSI…

More about that in another post.

Gravatar