This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Shortcut folder name based on property
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Mar 13, 2012
06:28 PM
Shortcut folder name based on property
Hi,
I am using an evaluation copy of IS 2012 and I am trying to create some folders in the shortcut menu, but one of them should be based on a property. So my shortcut should be located in "Programs Menu\My Company\My Program\[ProductVersion]\". However the folder named [ProductVersion] does not evaluate to the product version. How do I get this functionality?
The reason I want this functionality is so that I can have multiple versions of the same program.
Thanks.
I am using an evaluation copy of IS 2012 and I am trying to create some folders in the shortcut menu, but one of them should be based on a property. So my shortcut should be located in "Programs Menu\My Company\My Program\[ProductVersion]\". However the folder named [ProductVersion] does not evaluate to the product version. How do I get this functionality?
The reason I want this functionality is so that I can have multiple versions of the same program.
Thanks.
(6) Replies
‎Mar 13, 2012
06:32 PM
It's not easy. Unfortunately the underlying Windows Installer database schema ( Shortcut table ) doesn't support formatting that column.
The only two ways I know how to do it are:
1) Use a custom action to emit temporary records into the table at install time and allow MSI to create the shortcut
2) Use custom actions to create and remove the shortcuts yourself.
The only two ways I know how to do it are:
1) Use a custom action to emit temporary records into the table at install time and allow MSI to create the shortcut
2) Use custom actions to create and remove the shortcuts yourself.
‎Mar 13, 2012
07:03 PM
Okay. I've been looking through your blog recently and I'm using WiX for C# integration but so far I haven't done anything with the database. Assuming I go with 1) are there any good resources you could point me to on accomplishing this?
Thanks for the help.
Thanks for the help.
‎Mar 13, 2012
08:58 PM
Checkout my article:
http://blog.deploymentengineering.com/2008/07/dynamic-windows-installer-ui.html
Now assuming that your MSI builds a Shortcut table.... ( it gets messier if you need to create the table. It's best to have something, even a fake component with a no-op component condition so that it never gets installed, that has a Shortcut to make sure the table exists.
Use the static InsertRecord function from my blog like this.
InsertRecord(
session,
"Shortcut",
new object[]
{
"emittedShortcut1",
"DesktopFolder",
session["MyShortCutNameProperty"],
"MyComponent",
"[#somefilekey]",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
});
http://blog.deploymentengineering.com/2008/07/dynamic-windows-installer-ui.html
Now assuming that your MSI builds a Shortcut table.... ( it gets messier if you need to create the table. It's best to have something, even a fake component with a no-op component condition so that it never gets installed, that has a Shortcut to make sure the table exists.
Use the static InsertRecord function from my blog like this.
InsertRecord(
session,
"Shortcut",
new object[]
{
"emittedShortcut1",
"DesktopFolder",
session["MyShortCutNameProperty"],
"MyComponent",
"[#somefilekey]",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
});
‎Mar 15, 2012
11:50 AM
I actually did exactly what you're trying to do, set the version as the Folder name in Programs Menu. It's actually not that complicated as the other answers given.
What you do is create a Custom Actions to set a Directory. I used a Directory Name of SHORT_CUT_VER_FLDR, then set the Directory Value to [ProgramMenuFolder]\[Manufacturer]\[ProductName]\[ProductVersion] .
Then set that to run just after Cost Finalize, I set it there for Install UI and Install Exec with it set to Execute Only Once.
Then in the Shortcut properties, Select that Folder you wish to name to the version and in the KEY NAME enter the Directory Name above, SHORT_CUT_VER_FLDR.
That's it. Works great for me.
Hope that helps,
J
What you do is create a Custom Actions to set a Directory. I used a Directory Name of SHORT_CUT_VER_FLDR, then set the Directory Value to [ProgramMenuFolder]\[Manufacturer]\[ProductName]\[ProductVersion] .
Then set that to run just after Cost Finalize, I set it there for Install UI and Install Exec with it set to Execute Only Once.
Then in the Shortcut properties, Select that Folder you wish to name to the version and in the KEY NAME enter the Directory Name above, SHORT_CUT_VER_FLDR.
That's it. Works great for me.
Hope that helps,
J
‎Mar 15, 2012
07:19 PM
Thanks J. Got it working quite easily from that.
The custom action I wrote from Christopher's suggestion executed without errors, but for some reason the shortcut wasn't created.
Thanks for the help guys!
The custom action I wrote from Christopher's suggestion executed without errors, but for some reason the shortcut wasn't created.
Thanks for the help guys!
‎Mar 15, 2012
08:04 PM
I just realized that I speed read this post. If you only want the same shortcut name but in a different directory, then yes, use a Type 51 or Type 35 custom action to redirect the directory table entry to the desired location.
However, if you need to have transformed shortcut names in the same directory ( DesktopFolder MyApp-Prod MyApp-Test for example ) then the only way is what I described.
I tested the code that I wrote. It's a very clean way of doing it because you are still leverage MSI's standard actions for creating and removing the shortcuts. If it's not working for you, make sure you are emitting the row in the Shortcut table correctly. One of the disadvantages of dynamic MSI authoring at install time is you lose all of your ICE validation capabilities so you must be certain to do it 100% correctly.
However, if you need to have transformed shortcut names in the same directory ( DesktopFolder MyApp-Prod MyApp-Test for example ) then the only way is what I described.
I tested the code that I wrote. It's a very clean way of doing it because you are still leverage MSI's standard actions for creating and removing the shortcuts. If it's not working for you, make sure you are emitting the row in the Shortcut table correctly. One of the disadvantages of dynamic MSI authoring at install time is you lose all of your ICE validation capabilities so you must be certain to do it 100% correctly.