Groups | Blog | Home
all groups > visual studio .net ide > march 2004 >

visual studio .net ide : Deployment: How to do complex expressions.


Stephen Walch
3/11/2004 11:08:54 AM
I have a deployment that uses Launch Condition to read a value from the
registry and then uses that value as the default value for a prompt in a
Textboxes dialog. This works fine, but now I want to do something more
complex. I would like the default value in the textbox to be a combination
of two registry values. Something like this:

If( [REGVALUE1]="") Then [REGVALUE2] Else [REGVALUE1]

But I cannot find any way to express this type of thing. Custom Actions
seem to be out of the question because they do not execute until after the
dialogs are displayed. Is there any hope?

v-felwa NO[at]SPAM online.microsoft.com
3/12/2004 3:30:44 AM
Hi Stephen,

Thanks for posting. Although we cannot do this with VS.Net's Setup project,
we can achieve the goal with Windows Installer Platform SDK tools. The
following steps are for your reference:

1. Install Windows Installer Platform SDK at the following site:

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

2. Install the "Orca.msi" included.

3. Create a new Setup project. Add 2 Registry search for the project.
Accept their default name settings. So they should be associated with
properties "REGISTRYVALUE1" and "REGISTRYVALUE2".

4. Add a "Textboxes (A)" dialog.

5. Build the project.

6. Use Orca to open the MSI generated.

7. Go to the "CustomAction" table. Change the row with
"CustomTextA_SetProperty_EDIT1" to the following:

Action, Type, Source, Target
CustomTextA_SetProperty_EDIT1, 307, EDITA1, [REGISTRYVALUE1]

Add the following row:

Action, Type, Source, Target
CustomTextA_SetProperty_EDIT1_2, 307, EDITA1, [REGISTRYVALUE2]

8. Go to the "InstallUISequence" table. Change the existing row with
"CustomTextA_SetProperty_EDIT1" to the following:

Action, Condition, Sequence
CustomTextA_SetProperty_EDIT1, REGISTRYVALUE1<>"", 701

Note that we only add the condition REGISTRYVALUE1<>"". We do not need to
change the action name or the sequence number.

Add a new row in the "InstallUISequence" table:

Action, Condition, Sequence
CustomTextA_SetProperty_EDIT1_2, REGISTRYVALUE1="", 705

9. Save and exit.

When we launch the MSI, the installation program will attempt to read from
the registry and assign the values to properties REGISTRYVALUE1 and
REGISTRYVALUE2. In the "Textboxes (A)" dialog, if REGISTRYVALUE1 is not
empty, the TextA.Edit1's value will be assigned with it (by the custom
action "CustomTextA_SetProperty_EDIT1"). If the REGISTRYVALUE1 is empty,
the TextA.Edit1's value will come from REGISTRYVALUE2 (by the custom action
"CustomTextA_SetProperty_EDIT1_2").

Please give it a try and see whether this helps or not.

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.
AddThis Social Bookmark Button