WIndows Installer Putting shortcuts into a custom folder with a property

Colin Young

I am building an installer with InstallShield. It is a basic MSI project (I'd rather not have any dependencies on InstallShield that might make it more difficult to move to WiX in the future). I am attempting to put some shortcuts into a custom folder that I'd like to locate as:

[INSTALLDIR]\[PROP] Environment

The shortcuts all will point to [INSTALLDIR]\My.exe [PROP], e.g. the installed executable with a command-line parameter.

In InstallShield (and, it appears, MSI) I can't just set the folder in the Directory table to [PROP] Environment (actually I can, but that gives me a folder literally named [PROP] Environment). I've tried to use a type 35 Custom Action (Set Directory) but it either does nothing or gives me Could not access network location {expanded property} Environment, depending on where in the sequence I've got it. Currently it is in the UI sequence after SetupProgress. I've tried it in various locations in both the UI and Execute sequences, with no luck.

In case it makes a difference to the solution, the ultimate goal is to be able to run the installer multiple times (either as maintenance or as multiple installations), but subsequent "installs" will simply add additional shortcuts in new folders, e.g.:

PROD Environment
TEST Environment
TRAINING Environment

Feel free to provide a WiX solution. I've found the WiX documentation and code much better at explaining what's going on than the IS help.

UPDATE: If it helps I've already got a .Net Custom Action (via DTF) in case I can do things that way. I'm thinking along the lines of creating the shortcuts in there. I'm not sure how that will impact things like advertising, and I know I'll need to add a CA for uninstall to remove them.

UPDATE UPDATE: It doesn't help. Or, at least, there is no need to do it that way, and, one might argue, it shouldn't be done that way.

Colin Young

The solution is pretty simple, if a bit convoluted. I created it initially using InstallShield, but after a point, you're going to stray beyond the capabilities of the InstallShield GUI. I'm going to document the MSI tables (from the InstallShield DirectEditor) so it should be easy to translate to WiX. You'll need to add identifiers where necessary (it should be obvious where you need them):

  1. Create an empty component in the feature that includes the shortcut:
    • in the FeatureComponents table, add a row: Feature_ = DefaultFeature and Component_ = MyCustomShortcuts
    • in the Component table add a row: Component = MyCustomShortcuts, Directory_ = MYSHORTCUTFOLDER
  2. Create the directory
    • in the Directory table add a row for your shortcuts: Directory = MYSHORTCUTFOLDER, Directory_Parent = TARGETDIR, DefaultDir = .
  3. Add a Custom Action, type 51 (Set Property) to name the folder according to the public property you would like to control the name:
    • Action = UpdateShortcutFolder, Type = 51, Source = MYSHORTCUTFOLDER, Target = [INSTALLDIR][SHORTCUT_FOLDER_PREFIX] Shortcuts
  4. Create your shortcut. In the Shortcut table add a row:
    • Directory = MYSHORTCUTFOLDER, Name=MyProg~1|MyProgram, Component = MyProgramComponent, Target = [INSTALLDIR]MyProgram.exe

That's it. The shortcut step is the point at which the InstallShield UI can't handle things. Fortunately, as of InstallShield Premier 2014, it just ignores what it doesn't understand, so you aren't going to see your shortcuts in the System Configuration/Shortcuts view. They will be installed however.

In my testing, it appears that the shortcuts are removed, as is the custom directory, when uninstalling.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Windows installer, access a custom property inside a custom action in C++

From Dev

Deleting files in the windows installer folder

From Dev

Add custom folder shortcuts to places list

From Dev

Windows 7 virus removed shortcuts and folder permisions

From Dev

Inno Setup shortcuts for folder are not opening in Windows 10

From Dev

How to clean Windows\Installer folder in Windows 10?

From Dev

Windows 8 installer folder grows exponentially

From Dev

Moving the Windows installer folder to a network share drive?

From Dev

Windows 10: Custom URL shortcuts on desktop with Edge

From Dev

Custom shortcuts don't work with Windows 10

From Dev

Sort folder full of shortcuts by Destination property in Details view?

From Dev

pin TWO folder shortcuts as separate icons on Windows 7 taskbar?

From Dev

Do Shortcuts inside the Startup folder execute at boot or at logon? (Windows 7)

From Dev

How can I use shortcuts in this minimalist Windows folder browser dialog?

From Dev

Windows 10 denies creating shortcuts in Start Menu Folder

From Dev

Does Windows7 support symbolic links (folder 'shortcuts')?

From Dev

Can I delete the folder "C:\WINDOWS\Installer\$PatchCache$"?

From Dev

Windows folder shortcuts: how to have the deployed folder tree in left sidebar as well?

From Dev

Putting a :map property on an image

From Dev

Putting <> in bean property value?

From Dev

TortoiseSVN Folder-Shortcuts

From Dev

FTP shortcuts to another folder

From Dev

How to install application in custom folder using wix installer,other than Program Files folder

From Dev

How to validate a path stored in a property in Windows installer XML (WIX)

From Dev

Windows Installer custom actions: commit action won't get executed

From Dev

Custom Windows Installer to install multiple software from remote location

From Dev

Putting custom method to custom component

From Dev

Heroku: Putting a file in the bin folder

From Dev

Set custom folder icon for a network folder in Windows File Explorer

Related Related

  1. 1

    Windows installer, access a custom property inside a custom action in C++

  2. 2

    Deleting files in the windows installer folder

  3. 3

    Add custom folder shortcuts to places list

  4. 4

    Windows 7 virus removed shortcuts and folder permisions

  5. 5

    Inno Setup shortcuts for folder are not opening in Windows 10

  6. 6

    How to clean Windows\Installer folder in Windows 10?

  7. 7

    Windows 8 installer folder grows exponentially

  8. 8

    Moving the Windows installer folder to a network share drive?

  9. 9

    Windows 10: Custom URL shortcuts on desktop with Edge

  10. 10

    Custom shortcuts don't work with Windows 10

  11. 11

    Sort folder full of shortcuts by Destination property in Details view?

  12. 12

    pin TWO folder shortcuts as separate icons on Windows 7 taskbar?

  13. 13

    Do Shortcuts inside the Startup folder execute at boot or at logon? (Windows 7)

  14. 14

    How can I use shortcuts in this minimalist Windows folder browser dialog?

  15. 15

    Windows 10 denies creating shortcuts in Start Menu Folder

  16. 16

    Does Windows7 support symbolic links (folder 'shortcuts')?

  17. 17

    Can I delete the folder "C:\WINDOWS\Installer\$PatchCache$"?

  18. 18

    Windows folder shortcuts: how to have the deployed folder tree in left sidebar as well?

  19. 19

    Putting a :map property on an image

  20. 20

    Putting <> in bean property value?

  21. 21

    TortoiseSVN Folder-Shortcuts

  22. 22

    FTP shortcuts to another folder

  23. 23

    How to install application in custom folder using wix installer,other than Program Files folder

  24. 24

    How to validate a path stored in a property in Windows installer XML (WIX)

  25. 25

    Windows Installer custom actions: commit action won't get executed

  26. 26

    Custom Windows Installer to install multiple software from remote location

  27. 27

    Putting custom method to custom component

  28. 28

    Heroku: Putting a file in the bin folder

  29. 29

    Set custom folder icon for a network folder in Windows File Explorer

HotTag

Archive