|
#1
|
|||
|
|||
|
Shortcut icon index - using variable not possible?
I have main installer project that get build with 5 different flavors. The are only cosmetic differences in desktop icons, titles and command line parameters. So I want to have only one installer project and drive the build flavor with variables.
Question: All my icons already embedded into EXE. Can I use variable to specify different icon index for different flavor? So far I do not see how. The icon index edit only allows digits. How else it can be done without extracting icons into 5 different files? Thank you |
|
#2
|
||||
|
||||
|
You might want to extract those icons into 5 .ico files anyway. Windows Installer actually stores the whole file (that the icon comes from) in the .msi data -- so if an icon is coming from an executable, you're storing another full copy of that executable in the .msi file just for the icon.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#3
|
|||
|
|||
|
So far I could not make it work. I was able to trace the problem to the custom icon naming. But I do not know how to solve it.
On the build PC I have 2 icons MyProduct_XML.ico MyProduct_HTML.ico In the project on the MyProduct.EXE file properties I checked "Use Custom Icon" and linked to "MyProduct_$(var.APP_TARGET_NAME).ico". I set the variable at runtime to either "XML" or "HTML". During installation time everything works fine if I have only one product installed (XML or HTML) - if I install both - I get only one icon instead of two. Thats because the shortcuts on the customer PC are linked to the icon name "MyProduct_0001.ico" and second installation overrides icon from the first one. I do need different icons! full path is the same for both shortcuts "MyProduct for XML" and "MyProduct for HTML" :( %APPDATA%\Microsoft\Installer\{5227F9EE-70C2-420D-84E6-6B1F1550A86F}\MyProduct_0001.ico Here is a question. Where is the name "MyProduct_0001.ico" is coming from and how can I change it? If I can add variable name to the icon name - it all should work fine. |
|
#4
|
||||
|
||||
|
Quote:
Quote:
Quote:
In MSI the IDs for icon elements are limited to 18 characters to support "modularization." Build variables aren't expanded until after the .wxs file is generated, which means that the string you entered -- "MyProduct_$(var.APP_TARGET_NAME).ico" -- is 36 characters, too long for an icon ID. SFWI is automatically generating a shorter name for you (note that "MyProduct_0001.ico" is 18 characters long). The strange thing is, that should only be affecting the icon ID, not the shortcut path. What did you use for the shortcut description in SFWI? For version 1.1.1004 we added some intelligence to the build process to avoid including multiple copies of the same icon in the .msi file. (This is especially helpful if someone specifies an icon from a large file such as their main executable.) SFWI is trying to be smart by seeing that you used the same icon file ("MyProduct_$(var.APP_TARGET_NAME).ico") in both places and preventing what looks like unnecessary duplication.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#5
|
|||
|
|||
|
Quote:
Quote:
Quote:
I tried changing to 1. "MyProduct for $(var.APP)" 2. "$(var.APP)" No difference. The full icon path after building and installing product is still %APPDATA%\Microsoft\Installer\{5227F9EE-70C2-420D-84E6-6B1F1550A86F}\MyProduct_0001.ico Is there any way to squeeze variable value into the last part "MyProduct_0001.ico" ? |
|
#6
|
||||
|
||||
|
Quote:
For the shorter icon name, it's the presence of the build variable that's the problem -- the build variable syntax contains characters that aren't valid for an icon ID, so those characters get stripped out. (It would be better if it were expanded before it's determined to be invalid, but at the moment that isn't the case.) To be a valid icon ID, the first character needs to be a letter or an underscore, the ID must end with the same extension as the icon file, and the entire length needs to be 18 characters or less. Quote:
My$(var.APP).ico ...with $(var.APP) set to "Product_XML" Note: this is for the icon name -- the filename, description, etc. should not matter at all. I'm 99% sure this will not work either -- you'll end up with something like Myvar.APP.ico for the icon name, which means there's no $(var.APP) to be expanded any more. Unfortunately I think the only way to differentiate the icon names between builds in the current version (1.1.1004) is to:
(Thanks for bringing this to our attention btw.)
__________________
--[[ Indigo Rose Software Developer ]] |
|
#7
|
||||
|
||||
|
(Logged as bug REF: 16147.)
__________________
--[[ Indigo Rose Software Developer ]] |
|
#8
|
|||
|
|||
|
Quote:
%APPDATA%\Microsoft\Installer\{5227F9EE-70C2-420D-84E6-6B1F1550A86F}\MyProduct_0001.ico I tried using short static names like "MyIconAAA.ico" - and it is still gets renamed somewhere to "MyProduct_0001.ico". |
|
#9
|
||||
|
||||
|
Quote:
In your case, the first 10 characters are the same in both cases ("MyProduct_") so you aren't going to see any difference between the icon IDs that are generated. I mentioned this to Brett and he suggested defining multiple Create Shortcut actions and using their component conditions to control which icon is installed. Quote:
Quote:
If you don't change the product code, the second installer you run will just perform small update. According to Microsoft, "Small updates and minor upgrades are essentially a reinstallation that uses a new package." If you try to install two "products" without changing the product code, you won't actually have both products installed, you'll have one replacing the other, or end up with some mashed up frankenstein product. In other words, if you want those 5 "flavors" to act like 5 different products, you need to actually make them 5 different products. Note that you may also need to change some or all of your component IDs between the 5 different products. For example if any files or registry items are stored in different locations between products, they can't have the same component ID. (See Organizing Applications into Components in the MSDN.) You might even want to create a merge module for the components that are common between your products. I would strongly recommend that you consult Microsoft's online documentation for the specific rules you need to follow.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#10
|
|||
|
|||
|
Quote:
Quote:
This is just the way we build/distribute our product. We are not going to change it anytime soon. Making either small update or minor upgrade works fine in this scenario. I tested it with SFWI and I was satisfied with the results. The "big" concept is not the issue at the moment. I got almost all my questions covered and answered... Now if I can only figure out the shortcut icon issue - we would be good to go to migrate to SFWI |
|
#11
|
||||
|
||||
|
Quote:
Quote:
First, use the build variable to control the custom icon filename. You can't control the icon ID that SFWI generates, so just let it use MyProduct_0001.ico. Set up a build step (Build > Settings > Build Steps) to run before compiling the setup.wxs file that searches for "MyProduct_0001.ico" and replaces it with a different icon ID based on the build variable. (Either find a free grep tool that accepts command line parameters, or even build a custom app.) That will allow you to change the icon ID in the setup.wxs file before WiX compiles it, and still achieve an automated build process.
__________________
--[[ Indigo Rose Software Developer ]] Last edited by Lorne; 07-18-2007 at 04:28 PM. |
|
#12
|
|||
|
|||
|
And we have a winner! Thank you, that hack worked!
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell.CreateShortcut - Icon fails to show | mjt1 | Setup Factory 7.0 Discussion | 1 | 09-08-2006 04:59 PM |
| ICON for shortcut | jcorbett2 | AutoPlay Media Studio 4.0 | 1 | 08-11-2003 06:26 PM |
| HOWTO: Uninstall a Shortcut Created with Actions | Support | Setup Factory 6.0 Knowledge Base | 0 | 09-25-2002 10:50 AM |
| shortcut Icon | purple | Setup Factory 5.0 | 5 | 08-03-2000 03:16 AM |
| Shortcut Icon | dburrill | Setup Factory 5.0 | 0 | 07-13-2000 03:17 AM |
All times are GMT -6. The time now is 10:23 AM.









Linear Mode

