Setting up shortcuts in installer

  • Thread starter Thread starter Luke Wright
  • Start date Start date
L

Luke Wright

Hi,

I have built a setup project to install an application I
am developing. I would like to be able to prompt the user
whether to install Shortcuts in the following locations:
* Start Menu
* Desktop
* Quick Launch

I have added a UI page that has three checkboxes on it to
let the user choose which shortcuts to install. However,
it seems that a shortcut does not have a Condition
property that I can use to conditionally include the
shortcut based upon a user input.

I have gotten around this by using a hack (making three
copies of the startup executable, setting the condition
property on each, and pointing each of the three
shortcuts to a different target -- if a target is not
created, the corresponding shortcut is not either) but I
need a better solution.

What is the best way to go about this? I started down the
path of letting it create all three shortcuts, then
deleting the unwanted ones in a custom action, but that
seems error-prone.

Thanks,
Luke Wright
 
Hi Luke,

Thanks for posting.

We don't have a formal way to achieve this goal within VS.Net. However, we
can use Platform SDK tools to do this.

I will get back to you as soon as possible with detailed steps.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Luke,

I will give you an example on creating a shortcut on desktop only:

1. Create a MSI for your project using VS.Net. Add a "Checkboxes" dialog.
Add a shortcut for the primary output in "Program Menu"

2. Go to the following site to downloand and install Windows Installer SDK:

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

3. Install "Orca.msi" included.

4. Use "Orca.exe" to open the MSI file we have generated.

5. Open "Component" table. There should be one row generated by VS.Net.
Add one row:

Component: Component_Desktop

Component_ID: {E93098AA-E938-54EC-EEAC-6383E471F0EF}
(This is in fact a GUID. We can get one from the existing component and
change one bit.)

Condition: CHECKBOXA1
(This should be consistent to the property of our check box in VS.Net.)

Leave other fields the same as the existing row.

6. Open "FeatureComponents" table. Add one row:

Feature: DefaultFeature

Component: Component_Desktop

7. Open "Shortcut" table. There should be one row for the shortcut we have
created in Program Menu. Add one row:

Shortcut: Shortcut_Desktop

Directory: DesktopFolder

Component: Component_Desktop

Leave other fields the same as the existing row (or empty).

8. Save the MSI file and exit.

Please have a try and see whether this helps.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Felix,

I followed your instructions, - ran the resulting .msi file, and got a
2356 error. - which means "Couldn't locate cabinet in stream: [2]."
(errors on page: http://msdn.microsoft.com/library/d...y/en-us/msi/setup/launchconditions_action.asp)

It appears that the new .msi file that orca saved is about 50% smaller
than the original .msi file, and I am suspecting that somehow some of
the enclosed contents weren't saved back to the new file.

Do you know how to avoid this truncation when saving from orca?

thanks

Anatoly
 
Hi Anatoly,

Thanks for posting. However I don't think that modifying the tables as I
suggest in the previous post will cause the MSI becomes 50% smaller. I have
also been using Orca for some time and generally it does not truncate the
MSI package (except for file system failures).

Based on the error message, it seems that your issue is related to cabinet.
Cab files are stored in a hidden table "_Streams" and are their information
is recoreded in the "Media" and "File" table. There does not seem to be a
direct relation to the original shortcut issue. It is likely that a Cab
file is not properly imported into the "_Streams" table here.

I suggest that you first test my steps on a bare-bone VS.Net MSI. If they
work, then let's apply the steps to a more complicated MSI.

I hope this helps.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Anatoly,

Thanks for the information. Previously I was not aware of this, as I always
copy the file first and then edit it.

If you have any concerns regarding my steps, please feel free to post.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top