[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.setup

Use of condition in setup

John

1/23/2010 6:12:00 AM

Hi

I need the following when setup for my WinFrom app is run;

Setup gives two options A & B to the user during setup. Then depending on
the option selected by user, setup creates the app shortcut as below;

Option A
Shortcut is called A with icon 1

Option B
Shortcut is called B with icon 2 and a parameter abc passed to the app

Is it possible to achieve this via setup in VS? If so, would appreciate some
easy instructions on how to do this as there does not seem much
documentation on this.

Many Thanks

Regards



6 Answers

Wilson, Phil

1/25/2010 5:41:00 PM

0

Basically you add both to your setup. That means adding the exe twice,
creating a shortcuts for each with the required properties (see Properties
window on each) and then using the condition on your UI to choose one or the
other. You can't separate the shortcut from its target exe in VS setup
projects because they are in the same internal component.

--
Phil Wilson
The Definitive Guide to Windows Installer
http://www.apress.com/book/view/...


"John" <info@nospam.infovis.co.uk> wrote in message
news:usrG6L$mKHA.5508@TK2MSFTNGP02.phx.gbl...
> Hi
>
> I need the following when setup for my WinFrom app is run;
>
> Setup gives two options A & B to the user during setup. Then depending on
> the option selected by user, setup creates the app shortcut as below;
>
> Option A
> Shortcut is called A with icon 1
>
> Option B
> Shortcut is called B with icon 2 and a parameter abc passed to the app
>
> Is it possible to achieve this via setup in VS? If so, would appreciate
> some easy instructions on how to do this as there does not seem much
> documentation on this.
>
> Many Thanks
>
> Regards
>
>
>

John

1/26/2010 1:23:00 AM

0

Hi Wilson

Thanks for this. How do I tie my setup ui user selection with choosing to
install one or the other exe ie what sort of coding or setting within setup
will tie the user selection which what exe setup is going to install?

Thanks again.

Regards

"Wilson, Phil" <philw@wonderware.nospam.com> wrote in message
news:050130E6-A398-4B7C-BFE8-F1C5F5EC3340@microsoft.com...
> Basically you add both to your setup. That means adding the exe twice,
> creating a shortcuts for each with the required properties (see Properties
> window on each) and then using the condition on your UI to choose one or
> the other. You can't separate the shortcut from its target exe in VS setup
> projects because they are in the same internal component.
>
> --
> Phil Wilson
> The Definitive Guide to Windows Installer
> http://www.apress.com/book/view/...
>
>
> "John" <info@nospam.infovis.co.uk> wrote in message
> news:usrG6L$mKHA.5508@TK2MSFTNGP02.phx.gbl...
>> Hi
>>
>> I need the following when setup for my WinFrom app is run;
>>
>> Setup gives two options A & B to the user during setup. Then depending on
>> the option selected by user, setup creates the app shortcut as below;
>>
>> Option A
>> Shortcut is called A with icon 1
>>
>> Option B
>> Shortcut is called B with icon 2 and a parameter abc passed to the app
>>
>> Is it possible to achieve this via setup in VS? If so, would appreciate
>> some easy instructions on how to do this as there does not seem much
>> documentation on this.
>>
>> Many Thanks
>>
>> Regards
>>
>>
>>
>


Family Tree Mike

1/26/2010 3:09:00 AM

0

On 1/25/2010 8:23 PM, John wrote:
> Hi Wilson
>
> Thanks for this. How do I tie my setup ui user selection with choosing to
> install one or the other exe ie what sort of coding or setting within setup
> will tie the user selection which what exe setup is going to install?
>

I don't have the full version at home, but basically you add a custom
dialog as shown here,
http://msdn.microsoft.com/en-us/library/taa.... The retrieval of
the values then can be used to set the condition property of the
shortcut install. I forget the property name, but it is something like
"install condition".

Another option is to create a custom action, which is basically a dll
you write yourself that sets up the icon. This dll can launch it's own
dialog to ask the user what they want.


--
Mike

John

1/26/2010 4:08:00 AM

0

Hi

>The retrieval of the values then can be used to set the condition property
>of the shortcut install. "

This is the part I am stuck at. What code/settings do I need to accomplish
this?

Many Thanks

Regards

"Family Tree Mike" <FamilyTreeMike@ThisOldHouse.com> wrote in message
news:%23uyg3TjnKHA.5344@TK2MSFTNGP04.phx.gbl...
> On 1/25/2010 8:23 PM, John wrote:
>> Hi Wilson
>>
>> Thanks for this. How do I tie my setup ui user selection with choosing to
>> install one or the other exe ie what sort of coding or setting within
>> setup
>> will tie the user selection which what exe setup is going to install?
>>
>
> I don't have the full version at home, but basically you add a custom
> dialog as shown here,
> http://msdn.microsoft.com/en-us/library/taa.... The retrieval of
> the values then can be used to set the condition property of the shortcut
> install. I forget the property name, but it is something like "install
> condition".
>
> Another option is to create a custom action, which is basically a dll you
> write yourself that sets up the icon. This dll can launch it's own dialog
> to ask the user what they want.
>
>
> --
> Mike



Family Tree Mike

1/26/2010 12:44:00 PM

0

"John" wrote:

> Hi
>
> >The retrieval of the values then can be used to set the condition property
> >of the shortcut install. "
>
> This is the part I am stuck at. What code/settings do I need to accomplish
> this?
>
> Many Thanks
>
> Regards
>
>

Well, what I thought you would do is to set the condition on the shortcut in
the File System View, but the shortcuts on the desktop don't seem to have a
condition property. The User's Desktop has the condition property.

If you added a two radio button gui to your setup project, the properties
for the dialog let you set the properties for the options. You can set a
value for Button1Value and Button2Value, which default to 1 and 2. The
ButtonProperty property was how I thought you set the condition to the
shortcut, by setting the "Condition" property to something like
"[INSTALLSC]=1". You could do this on the entire "User's Desktop" folder,
but this sounds like it wont work for you.

I don't recall the steps of creating a desktop icon in a custom action, but,
that question has been asked here before. What you would do is create a
custom action dll. Instead of a condtion though, you would pass the actuall
property ([INSTALLSC]) to the dll. The dll then looks if they chose a value
of button 1 or button 2. To pass the value to the dll, you would use this in
the CustomActionData property: /Option="[INSTALLSC]", and in the custom
action you retrieve the value with: Me.Context.Parameters("INSTALLSC").
(BTW, I usually use C#, so I use this.Context.Parameters["INSTALLSC"], but I
think I translated correctly.)

I hope this helps get you closer.

Mike

Wilson, Phil

1/26/2010 5:56:00 PM

0

The underlying issue is that you cannot have a condition on a shortcut,
despite the fact that it appears that way in Visual Studio. It's bound to
its target file. That's why the op needs to:

1. Add the exe; create shortcut in option A, name it A. Drag to the required
location. Property window for the shortcut in the IDE, set the Icon
property.
2. Add the exe again in a different folder; create the shortcut B, call it
B, Property window on the shortcut has Icon and Arguments to set.
3. Add that radiobutton dialog.
4. If the property is BUTTON2 use the conditionBUTTON2=1 on one exe and
BUTTON2=2 on the other.

Visual Studio setups aren't fully featured, that's why some hoops need
jumping through here. It's not Wise, WiX, or InstallShield. The alternative
is to write code in a custom action to create shortcuts depending on the
button property value, and remember to have a corresponding uninstall custom
action too.

--
Phil Wilson
The Definitive Guide to Windows Installer
http://www.apress.com/book/view/...


"Family Tree Mike" <FamilyTreeMike@discussions.microsoft.com> wrote in
message news:4C4900C2-F02D-47E1-9076-1D7A13CE7CD5@microsoft.com...
> "John" wrote:
>
>> Hi
>>
>> >The retrieval of the values then can be used to set the condition
>> >property
>> >of the shortcut install. "
>>
>> This is the part I am stuck at. What code/settings do I need to
>> accomplish
>> this?
>>
>> Many Thanks
>>
>> Regards
>>
>>
>
> Well, what I thought you would do is to set the condition on the shortcut
> in
> the File System View, but the shortcuts on the desktop don't seem to have
> a
> condition property. The User's Desktop has the condition property.
>
> If you added a two radio button gui to your setup project, the properties
> for the dialog let you set the properties for the options. You can set a
> value for Button1Value and Button2Value, which default to 1 and 2. The
> ButtonProperty property was how I thought you set the condition to the
> shortcut, by setting the "Condition" property to something like
> "[INSTALLSC]=1". You could do this on the entire "User's Desktop" folder,
> but this sounds like it wont work for you.
>
> I don't recall the steps of creating a desktop icon in a custom action,
> but,
> that question has been asked here before. What you would do is create a
> custom action dll. Instead of a condtion though, you would pass the
> actuall
> property ([INSTALLSC]) to the dll. The dll then looks if they chose a
> value
> of button 1 or button 2. To pass the value to the dll, you would use this
> in
> the CustomActionData property: /Option="[INSTALLSC]", and in the custom
> action you retrieve the value with: Me.Context.Parameters("INSTALLSC").
> (BTW, I usually use C#, so I use this.Context.Parameters["INSTALLSC"], but
> I
> think I translated correctly.)
>
> I hope this helps get you closer.
>
> Mike