How to detect files presence and conditionally show a new added dialog page

26 messages Options
Embed this post
Permalink
1 2
little.forest

How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
We use WiX 3.0.4805.0.

Requirement:

-----------
1. Detect "[AppData]\MyCompany\MyApp 2.0" folder and "[AppData]\MyCompany\MyApp 3.0" folder, if there IS NO files/folders in 3.0 folder and there ARE files/folders in 2.0 folder, then setup a property
2. Based on the detection result in step one, show a dialog to ask the end user if she wants to migrate her settings from 2.0 folder to 3.0 folder.

Questions:
---------
1. I know there is a way to detect a file's presence like this:
<Property Id="MSIVERSION31">
<DirectorySearch Id="SystemFolderDriverVersion" Path="[SystemFolder]">
<FileSearch Name="msi.dll" MinVersion="3.1"/>
</DirectorySearch>
</Property>
But I don't know how to detect *.*? I need to detect if there is any files/folders in 3.0 folder, and any files/folder in 2.0 folder. There is no way to know the exact file name or folder name until run time. The folder could include files like settings.xml, or it may not include any files at all but just include some folders like "james" or "alice". If the condition is meet, then set a property called MIGRATE_SETTINGS_PROPERTY.

2. Initially, I thought I can implement a popup dialog to ask if the end user wants to migrate the settings. If they want to, then I've a small external application can handle the settings migration. If they choose no, then we won't migrate the settings. But then I realized that I can't implement a popup dialog but I can insert a dialog. This solution is fine for me. I actually added one dialog. In this dialog, I added some elements and one checkbox called "Migrate my settings". It seems working. Here is some code from my version of WixUI_InstallDir.wxs:
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
The problem is, how can I conditionally show this dialog based on the property MIGRATE_SETTINGS_PROPERTY in the previous question? Namely, if we need to migrate settings, then show this dialog, otherwise, we shouldn't even show this dialog. How to do this?


Many thanks.
/Brian


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Richard-45

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink

Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe to detect and set the property, right? If so, is it possible that I can "reuse" my existing setting upgrade program? I already have a small program to handle setting upgrade - it accepts parameters to run like this "upgrade_settings.exe -run param1 param2". Can I run it something like "upgrade_settings.exe -detect param1 param2" just for detection reason? How can I make sure this detection run is before the actual setting upgrade running? I've a feeling that, for one program, we'd better not to run it twice in one installer. Or, even I can write another program to do the detection work, but how can I sequence these two apps to make the detection one run first? Maybe I'm wrong, but I worry about the program sequencing. Currently, I have these code:
            <Binary Id="SettingUpgraderApp" SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection" Before="DoSettingUpgrade">NOT Installed and REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed and and REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't translate your instructions to be actual code and make it work. Is it possible to provide some step by step instructions? I'd just like it more specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset. <[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Bob Arnson-6

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Blair-2
Blair wrote:
> "Type 19" is <CustomAction Property='PROPID' Value='My Value
> [WITHPROPERTIES] if needed'/>
>  

That's a 51, actually. 19 is error, which quite different.<g>

--
sig://boB
http://joyofsetup.com/



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by little.forest
I don't know the logic you are looking for, but here is one possibility (may
not be your correct logic, but if you can read this, check the
documentation, and determine what it will do, you should then understand
what you need to do to implement the logic you are looking for.

<Property Id="NEED_UPGRADE_SETTING" Secure="yes">
  <DirectorySearch Id="MyFileFolder" Path="C:\My\Files\Folder"
AssignToProperty="yes">
    <FileSearch Name="MyFile.ext"/>
  </DirectorySearch>
</Property>

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes">
<CustomAction Id="SetMyProperty" Property="REALLY_NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">Installed or NOT
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="WelcomeDlg" Order="1">Installed or NOT NEED_UPGRADE_SETTING</Publish>

<InstallUISequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>

If you can describe the logic (including UI) you are looking for and a way
to use file/directory/registry/MSI component searches to determine your need
to perform the upgrade, we can help you craft that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 3:23 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't
translate your instructions to be actual code and make it work. Is it
possible to provide some step by step instructions? I'd just like it more
specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a
newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bob Arnson-6
You're right, I didn't look it up, but it was given in the context of
setting properties, not aborting installations.

A type 19 looks like this:

<CustomAction Error="<error-number>" .../>
<UI><Error Id="<error-number>">Error Message</Error></UI>

Where <error-number> is an integer that is your Installer error value. Use
ones MSFT didn't define for your errors, above some number I don't remember
but I believe it is documented in MSDN (start from the Error table docs).

-----Original Message-----
From: Bob Arnson [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 4:47 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Blair wrote:
> "Type 19" is <CustomAction Property='PROPID' Value='My Value
> [WITHPROPERTIES] if needed'/>
>  

That's a 51, actually. 19 is error, which quite different.<g>

--
sig://boB
http://joyofsetup.com/



----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Blair-2
Hi Blair,


Thank you so much. I really appreciate your detailed reply. The code example you provided is clear and neat.

Basically, we'd like to do these:
1. Detect if we need to do a setting migration: look into "[AppData]\MyCompany\MyApp 3.0" folder and "[AppData]\MyCompany\MyApp 2.0" folder. If there is nothing in 3.0 folder(it means the user never install the 3.0 version) and there is something in 2.0 folder(it means the user ever used 2.0 version), then we should do setting upgrade. We'll need to set a property.
2. If the property is set, then we'll need to do setting upgrade. We'll show a new page after InstallDirDlg and before VerifyReadyDlg. In this page, we'll say "We have detected you have 2.0 settings. Do you want to upgrade these settings to 3.0?", and provide a checkbox.
If the property is not set, we do not show this setting migration page.
3. After installation but before it's finished, based on the property, we'll either run a small program to migrate settings, or do nothing.

So from these description, hopefully you've got our logic: we need to "detect->set property->show message on GUI->do setting migration".

Our setting folder structure is a bit of complicated. The setting folder may contain files(like settings.xml, or ui.xml), or may contain user's login(like "james" or "linda"). So when doing detection, we really couldn't count on a specific file. What we really need is to detect "*.*" which isn't supported by MSI. So I guess I'll have to write a DLL to do the detection work? Inside the DLL, I'll look into the source and destination folder and set property, right?

For display on GUI, with your code example and a lot of google searching and trying, I've got it work. Here is the code for dialog sequence, please point out errors if you find there is any:
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog" Value="MyDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and NEED_UPGRADE_SETTING="1"]]></Publish>
            <Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and NEED_UPGRADE_SETTING<>"1"]]></Publish>


<Publish Dialog="MyDlg" Control="Back" Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed and NOT NEED_UPGRADE_SETTING</Publish>


I made some testing, it seems working: if I explicitly set NEED_UPGRADE_SETTING property in my code, I did see the message page; if I don't, then I didn't see the page. So it's good.

So my goal is to look into the DLL which can detect if need to migrate setting and set the property. I'll get on it.

But there are still two things I'm not sure:
1. As you know, we have an EXE program to handle the setting migration. Is it okay to include both the detection DLL and the upgrade program EXE in one installer? Here is our setting upgrade program code part:
            <Binary Id="SettingUpgraderApp" SourceFile="upgrade_settings.exe"/>
            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
                          Execute="deferred"
                          Return="check"
                          HideTarget="no"
                          Impersonate="no" />


<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

2. How to make the detection happen before the actual setting migration program?

Am I doing the right thing? Or am I in the right direction? Please let me know.

Thanks again,
/Brian




________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset. <[hidden email]>
Sent: Tuesday, October 20, 2009 4:55:54 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page

I don't know the logic you are looking for, but here is one possibility (may
not be your correct logic, but if you can read this, check the
documentation, and determine what it will do, you should then understand
what you need to do to implement the logic you are looking for.

<Property Id="NEED_UPGRADE_SETTING" Secure="yes">
  <DirectorySearch Id="MyFileFolder" Path="C:\My\Files\Folder"
AssignToProperty="yes">
    <FileSearch Name="MyFile.ext"/>
  </DirectorySearch>
</Property>

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes">
<CustomAction Id="SetMyProperty" Property="REALLY_NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">Installed or NOT
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="WelcomeDlg" Order="1">Installed or NOT NEED_UPGRADE_SETTING</Publish>

<InstallUISequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>

If you can describe the logic (including UI) you are looking for and a way
to use file/directory/registry/MSI component searches to determine your need
to perform the upgrade, we can help you craft that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 3:23 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't
translate your instructions to be actual code and make it work. Is it
possible to provide some step by step instructions? I'd just like it more
specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a
newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
Can you live with the existence (or lack thereof) of those two settings
directories? Does it matter if they are empty or not? I would assume that if
the 3.0 one didn't exist but the 2.0 one does, you have a better than even
chance you have data to upgrade. Anytime you can use a built-in custom
action instead of supplying your own, you tend to improve reliability.
However, you can add as many custom actions (and custom action binaries)
into your installation package as you wish, up to the size limit of the MSI
file (not that you would ever want an MSI file that big).

I assume your "AppData" property is the APPDATA environment variable. If
not, change my "[%AppData]\" and ensure that the property is defined before
the AppSearch action. If it is defined in your Directory table, those
properties are not populated until CostFinalize. Note that if Windows
Installer defines a path, it always includes the trailing backslash ('\').
If you supply paths via your own custom action, you should do the same.

<Property Id="SETTINGS_20_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 2.0" Depth="0"/>
</Property>
<Property Id="SETTINGS_30_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 3.0" Depth="0"/>
</Property>

<Property Id="NEED_UPGRADE_SETTING" Secure="yes"/>
<CustomAction Id="SetNeedUpgradeSetting" Property="NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<InstallUISequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom>
</InstallUISequence>

If you can't use mere absence/presence of the folders for your detection
routine, don't use any of my code (except for the secure property
declaration of NEED_UPDRADE_SETTING) and instead set NEED_UPDRADE_SETTING in
your DLL action. Call your action with no condition in your
InstallUISequence where I call SetNeedUpgradeSetting.

Now, on to the InstallExecuteSequence. I am assuming that your confirmation
dialog (MyDlg) has a check box that is associated with the property
REALLY_NEED_UPGRADE_SETTING (which sets it to the value "1" if the box is
checked). What is your default? Also, if the UI is bypassed, what should the
assumed value be? I hope it is the same (checked by default, assumed checked
if never shown). That makes your logic easier.

You will need to make sure your REALLY_NEED_UPGRADE_SETTING property is also
secure. I will assume it is also checked by default. If you are using your
DLL instead of simple folder detection you should also set it to
Execute="firstSequence".

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes" Value="1"/><!--
remove 'Value="1"' but leave the rest if migrating settings is NOT the
default action-->

<InstallExecuteSequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom><!--Note that this is identical to
InstallUISequence. That is by design.-->
  <Custom Action="DoSettingUpgrade" Before="InstallFinalize">NOT Installed
AND REALLY_NEED_UPGRADE_SETTING AND NEED_UPGRADE_SETTING</Custom><!-- you
may consider removing "NOT Installed AND " from this condition. Then repairs
and minor upgrades will restore your 3.0 settings from the 2.0 ones if they
are "lost"-->
</InstallExecuteSequence>

If your default action and your opt-in/-out experience are different, you
will have a bit more complicated logic story, but I will leave that unless
you need help with that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 5:40 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Hi Blair,


Thank you so much. I really appreciate your detailed reply. The code example
you provided is clear and neat.

Basically, we'd like to do these:
1. Detect if we need to do a setting migration: look into
"[AppData]\MyCompany\MyApp 3.0" folder and "[AppData]\MyCompany\MyApp 2.0"
folder. If there is nothing in 3.0 folder(it means the user never install
the 3.0 version) and there is something in 2.0 folder(it means the user ever
used 2.0 version), then we should do setting upgrade. We'll need to set a
property.
2. If the property is set, then we'll need to do setting upgrade. We'll show
a new page after InstallDirDlg and before VerifyReadyDlg. In this page,
we'll say "We have detected you have 2.0 settings. Do you want to upgrade
these settings to 3.0?", and provide a checkbox.
If the property is not set, we do not show this setting migration page.
3. After installation but before it's finished, based on the property, we'll
either run a small program to migrate settings, or do nothing.

So from these description, hopefully you've got our logic: we need to
"detect->set property->show message on GUI->do setting migration".

Our setting folder structure is a bit of complicated. The setting folder may
contain files(like settings.xml, or ui.xml), or may contain user's
login(like "james" or "linda"). So when doing detection, we really couldn't
count on a specific file. What we really need is to detect "*.*" which isn't
supported by MSI. So I guess I'll have to write a DLL to do the detection
work? Inside the DLL, I'll look into the source and destination folder and
set property, right?

For display on GUI, with your code example and a lot of google searching and
trying, I've got it work. Here is the code for dialog sequence, please point
out errors if you find there is any:
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING="1"]]></Publish>
            <Publish Dialog="MyInstallDirDlg" Control="Next"
Event="NewDialog" Value="VerifyReadyDlg"
Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING<>"1"]]></Publish>


<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed and NOT
NEED_UPGRADE_SETTING</Publish>


I made some testing, it seems working: if I explicitly set
NEED_UPGRADE_SETTING property in my code, I did see the message page; if I
don't, then I didn't see the page. So it's good.

So my goal is to look into the DLL which can detect if need to migrate
setting and set the property. I'll get on it.

But there are still two things I'm not sure:
1. As you know, we have an EXE program to handle the setting migration. Is
it okay to include both the detection DLL and the upgrade program EXE in one
installer? Here is our setting upgrade program code part:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>
            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
                          Execute="deferred"
                          Return="check"
                          HideTarget="no"
                          Impersonate="no" />


<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

2. How to make the detection happen before the actual setting migration
program?

Am I doing the right thing? Or am I in the right direction? Please let me
know.

Thanks again,
/Brian




________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 4:55:54 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

I don't know the logic you are looking for, but here is one possibility (may
not be your correct logic, but if you can read this, check the
documentation, and determine what it will do, you should then understand
what you need to do to implement the logic you are looking for.

<Property Id="NEED_UPGRADE_SETTING" Secure="yes">
  <DirectorySearch Id="MyFileFolder" Path="C:\My\Files\Folder"
AssignToProperty="yes">
    <FileSearch Name="MyFile.ext"/>
  </DirectorySearch>
</Property>

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes">
<CustomAction Id="SetMyProperty" Property="REALLY_NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">Installed or NOT
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="WelcomeDlg" Order="1">Installed or NOT NEED_UPGRADE_SETTING</Publish>

<InstallUISequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>

If you can describe the logic (including UI) you are looking for and a way
to use file/directory/registry/MSI component searches to determine your need
to perform the upgrade, we can help you craft that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 3:23 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't
translate your instructions to be actual code and make it work. Is it
possible to provide some step by step instructions? I'd just like it more
specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a
newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Richard-45

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by little.forest

In article <[hidden email]>,
    "little.forest" <[hidden email]>  writes:

> Hmm, can you tell me how to use AppSearch to "locate folders"?

Use <Property> with a nested <DirectorySearch>

> "Use type 19 CA to set properties"  [...]

As pointed out by others, I was wrong in saying type 19, its type 51
(set property) as already mentioned.

Not every CA requires a DLL or EXE -- only DLL/EXE CAs need them.  WiX
exposes a set property CA with <SetProperty>.

You can reuse your upgrade_settings.exe program, but you may find that
its more trouble than its worth because this means creating a custom
action in code and interacting with this external utility to set
properties in the MSI.  You might find it easier to have this upgrade
settings utility invoke msiexec on your MSI with command-line
arguments to set properties for the installation, essentially using
the upgrade settings utility as a bootstrapper.

> And the last question, "to use condition on events to determine dialogs shown
 in a wizard", is it some like this?
>             <Publish Dialog="MyDlg" Control="Back" Event="NewDialog" Value="M
yInstallDirDlg" Order="1">NOT Installed and and REALLY_NEED_UPGRADE_SETTING</Pu
blish>

Yes, but be careful about conditions and the fact that you need to
populate those conditions on the Next button *and* the back button
*and* you need to make sure that the conditions are setup properly so
that dialog transitions are managed properly.  Additionally, you can't
have more than one NewDialog control event on a button, even if the
conditions are mutually exclusive.  You'll get weird behavior if you
try this.

The way to manage complex dialog transitions is to use a property to
hold the name of the dialog you wish to display and conditionally set
this property to the right value.  Then transition to the dialog named
by the property:

For instance, suppose the transition table for the Back button on
MyDlg looks like this:

Target Dialog           Condition
Dialog1                 NOT A AND NOT B
Dialog2                 A AND NOT B
Dialog3                 A AND B
Dialog4                 NOT A AND B

The following <Publish> events show how to implement this logic with a
single NewDialog event on the Back button of MyDlg:

<!-- go to Dialog1 by default -->
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog1"/>
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog2">A AND NOT B</Publish>
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog3">A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog4">NOT A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
        Event="NewDialog" Value="[BackDialog]"/>

Note that the first set property event has no condition, guaranteeing
that the transition is always well defined.  You can also null out the
property and then take the NewDialog transition only when the property
is non-empty:

<!-- go to Dialog1 by default -->
<Publish Dialog="MyDlg" Control="Back" Property="BackDialog" Value="{}"/>
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog1">NOT A AND NOT B</Publish>
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog2">A AND NOT B</Publish>
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog3">A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
        Property="BackDialog" Value="Dialog4">NOT A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
        Event="NewDialog" Value="[BackDialog]">BackDialog</Publish>

--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Blair-2
Hi Blair,


Thank you for your kindly reply. I really appreciate it.

Yes, I think checking the folder presence instead of checking the files would work for us. I totally agree to use a built-in custom action instead of supplying my own for the reliability. The reason we wanted to check files(*.*) instead of folder is:
In our 2.0 installer(made by InstallShield), there is a way the end user can choose to "delete local settings" upon uninstallation. Actually, in 3.0, I was asked to do so as well. But up to now, "How to add a dialog box when uninstall" is still a pending issue for me(http://n2.nabble.com/How-to-add-a-dialog-box-when-uninstall-td3515946i20.html#a3569972). Anyways, we can live with it for now. But in 2.0, the setting remover just deletes the settings, it doesn't delete the folder. So if the end user ever uninstalled the 2.0 application once and she happened to choose "delete setting" option, chances are she'll end up with having all setting gone but left an empty 2.0 folder behind. By checking the folder, we'll get the result of "need to migrate setting", but actually there is no setting to migrate. Well, I agree there is nothing to lose even this happens. But still, I'll have a hard time to convince our QA and PM. Anyways, the bottom line is I could still
 do the DLL solution if they insist to check *.*.

Yes, there is a checkbox in MyDlg. The default value for that is 1(to migrate setting for the user). And yes, if the UI is bypassed, the value will be 1 as well.

By the way, your code example is beautiful. I learnt quite a few things from your reply, such as the 'secure' attribute in property element, InstallExecuteSequence/InstallUIExecuteSequence, and the way you set the NEED_UPGRADE_SETTING property. I'll give it a try.

Thanks again!
/Brian



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset. <[hidden email]>
Sent: Tuesday, October 20, 2009 7:27:41 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page

Can you live with the existence (or lack thereof) of those two settings
directories? Does it matter if they are empty or not? I would assume that if
the 3.0 one didn't exist but the 2.0 one does, you have a better than even
chance you have data to upgrade. Anytime you can use a built-in custom
action instead of supplying your own, you tend to improve reliability.
However, you can add as many custom actions (and custom action binaries)
into your installation package as you wish, up to the size limit of the MSI
file (not that you would ever want an MSI file that big).

I assume your "AppData" property is the APPDATA environment variable. If
not, change my "[%AppData]\" and ensure that the property is defined before
the AppSearch action. If it is defined in your Directory table, those
properties are not populated until CostFinalize. Note that if Windows
Installer defines a path, it always includes the trailing backslash ('\').
If you supply paths via your own custom action, you should do the same.

<Property Id="SETTINGS_20_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 2.0" Depth="0"/>
</Property>
<Property Id="SETTINGS_30_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 3.0" Depth="0"/>
</Property>

<Property Id="NEED_UPGRADE_SETTING" Secure="yes"/>
<CustomAction Id="SetNeedUpgradeSetting" Property="NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<InstallUISequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom>
</InstallUISequence>

If you can't use mere absence/presence of the folders for your detection
routine, don't use any of my code (except for the secure property
declaration of NEED_UPDRADE_SETTING) and instead set NEED_UPDRADE_SETTING in
your DLL action. Call your action with no condition in your
InstallUISequence where I call SetNeedUpgradeSetting.

Now, on to the InstallExecuteSequence. I am assuming that your confirmation
dialog (MyDlg) has a check box that is associated with the property
REALLY_NEED_UPGRADE_SETTING (which sets it to the value "1" if the box is
checked). What is your default? Also, if the UI is bypassed, what should the
assumed value be? I hope it is the same (checked by default, assumed checked
if never shown). That makes your logic easier.

You will need to make sure your REALLY_NEED_UPGRADE_SETTING property is also
secure. I will assume it is also checked by default. If you are using your
DLL instead of simple folder detection you should also set it to
Execute="firstSequence".

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes" Value="1"/><!--
remove 'Value="1"' but leave the rest if migrating settings is NOT the
default action-->

<InstallExecuteSequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom><!--Note that this is identical to
InstallUISequence. That is by design.-->
  <Custom Action="DoSettingUpgrade" Before="InstallFinalize">NOT Installed
AND REALLY_NEED_UPGRADE_SETTING AND NEED_UPGRADE_SETTING</Custom><!-- you
may consider removing "NOT Installed AND " from this condition. Then repairs
and minor upgrades will restore your 3.0 settings from the 2.0 ones if they
are "lost"-->
</InstallExecuteSequence>

If your default action and your opt-in/-out experience are different, you
will have a bit more complicated logic story, but I will leave that unless
you need help with that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 5:40 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Hi Blair,


Thank you so much. I really appreciate your detailed reply. The code example
you provided is clear and neat.

Basically, we'd like to do these:
1. Detect if we need to do a setting migration: look into
"[AppData]\MyCompany\MyApp 3.0" folder and "[AppData]\MyCompany\MyApp 2.0"
folder. If there is nothing in 3.0 folder(it means the user never install
the 3.0 version) and there is something in 2.0 folder(it means the user ever
used 2.0 version), then we should do setting upgrade. We'll need to set a
property.
2. If the property is set, then we'll need to do setting upgrade. We'll show
a new page after InstallDirDlg and before VerifyReadyDlg. In this page,
we'll say "We have detected you have 2.0 settings. Do you want to upgrade
these settings to 3.0?", and provide a checkbox.
If the property is not set, we do not show this setting migration page.
3. After installation but before it's finished, based on the property, we'll
either run a small program to migrate settings, or do nothing.

So from these description, hopefully you've got our logic: we need to
"detect->set property->show message on GUI->do setting migration".

Our setting folder structure is a bit of complicated. The setting folder may
contain files(like settings.xml, or ui.xml), or may contain user's
login(like "james" or "linda"). So when doing detection, we really couldn't
count on a specific file. What we really need is to detect "*.*" which isn't
supported by MSI. So I guess I'll have to write a DLL to do the detection
work? Inside the DLL, I'll look into the source and destination folder and
set property, right?

For display on GUI, with your code example and a lot of google searching and
trying, I've got it work. Here is the code for dialog sequence, please point
out errors if you find there is any:
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING="1"]]></Publish>
            <Publish Dialog="MyInstallDirDlg" Control="Next"
Event="NewDialog" Value="VerifyReadyDlg"
Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING<>"1"]]></Publish>


<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed and NOT
NEED_UPGRADE_SETTING</Publish>


I made some testing, it seems working: if I explicitly set
NEED_UPGRADE_SETTING property in my code, I did see the message page; if I
don't, then I didn't see the page. So it's good.

So my goal is to look into the DLL which can detect if need to migrate
setting and set the property. I'll get on it.

But there are still two things I'm not sure:
1. As you know, we have an EXE program to handle the setting migration. Is
it okay to include both the detection DLL and the upgrade program EXE in one
installer? Here is our setting upgrade program code part:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>
            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
                          Execute="deferred"
                          Return="check"
                          HideTarget="no"
                          Impersonate="no" />


<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

2. How to make the detection happen before the actual setting migration
program?

Am I doing the right thing? Or am I in the right direction? Please let me
know.

Thanks again,
/Brian




________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 4:55:54 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

I don't know the logic you are looking for, but here is one possibility (may
not be your correct logic, but if you can read this, check the
documentation, and determine what it will do, you should then understand
what you need to do to implement the logic you are looking for.

<Property Id="NEED_UPGRADE_SETTING" Secure="yes">
  <DirectorySearch Id="MyFileFolder" Path="C:\My\Files\Folder"
AssignToProperty="yes">
    <FileSearch Name="MyFile.ext"/>
  </DirectorySearch>
</Property>

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes">
<CustomAction Id="SetMyProperty" Property="REALLY_NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">Installed or NOT
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="WelcomeDlg" Order="1">Installed or NOT NEED_UPGRADE_SETTING</Publish>

<InstallUISequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>

If you can describe the logic (including UI) you are looking for and a way
to use file/directory/registry/MSI component searches to determine your need
to perform the upgrade, we can help you craft that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 3:23 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't
translate your instructions to be actual code and make it work. Is it
possible to provide some step by step instructions? I'd just like it more
specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a
newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Richard-45
Hi Richard,


Thanks for your reply.

"Additionally, you can't have more than one NewDialog control event on a button, even if the conditions are mutually exclusive." - this is interesting. Can you tell me where this fact comes from? I googled, it's not mentioned in Wix or MSI. Also, I found this post "Customized UI's for WiX"(http://neilsleightholm.blogspot.com/2008/08/customised-uis-for-wix.html ). There is code like this - you see Niel Sleightholm does have two NewDialog control event for one button:
      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg"
               Order="1">WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg"
               Order="2">WixUI_InstallMode = "InstallCustom"</Publish>Thanks.
/Brian



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Tuesday, October 20, 2009 9:44:55 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page


In article <[hidden email]>,
    "little.forest" <[hidden email]>  writes:

> Hmm, can you tell me how to use AppSearch to "locate folders"?

Use <Property> with a nested <DirectorySearch>

> "Use type 19 CA to set properties"  [...]

As pointed out by others, I was wrong in saying type 19, its type 51
(set property) as already mentioned.

Not every CA requires a DLL or EXE -- only DLL/EXE CAs need them.  WiX
exposes a set property CA with <SetProperty>.

You can reuse your upgrade_settings.exe program, but you may find that
its more trouble than its worth because this means creating a custom
action in code and interacting with this external utility to set
properties in the MSI.  You might find it easier to have this upgrade
settings utility invoke msiexec on your MSI with command-line
arguments to set properties for the installation, essentially using
the upgrade settings utility as a bootstrapper.

> And the last question, "to use condition on events to determine dialogs shown
in a wizard", is it some like this?
>             <Publish Dialog="MyDlg" Control="Back" Event="NewDialog" Value="M
yInstallDirDlg" Order="1">NOT Installed and and REALLY_NEED_UPGRADE_SETTING</Pu
blish>

Yes, but be careful about conditions and the fact that you need to
populate those conditions on the Next button *and* the back button
*and* you need to make sure that the conditions are setup properly so
that dialog transitions are managed properly.  Additionally, you can't
have more than one NewDialog control event on a button, even if the
conditions are mutually exclusive.  You'll get weird behavior if you
try this.

The way to manage complex dialog transitions is to use a property to
hold the name of the dialog you wish to display and conditionally set
this property to the right value.  Then transition to the dialog named
by the property:

For instance, suppose the transition table for the Back button on
MyDlg looks like this:

Target Dialog           Condition
Dialog1                 NOT A AND NOT B
Dialog2                 A AND NOT B
Dialog3                 A AND B
Dialog4                 NOT A AND B

The following <Publish> events show how to implement this logic with a
single NewDialog event on the Back button of MyDlg:

<!-- go to Dialog1 by default -->
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog1"/>
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog2">A AND NOT B</Publish>
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog3">A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog4">NOT A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
    Event="NewDialog" Value="[BackDialog]"/>

Note that the first set property event has no condition, guaranteeing
that the transition is always well defined.  You can also null out the
property and then take the NewDialog transition only when the property
is non-empty:

<!-- go to Dialog1 by default -->
<Publish Dialog="MyDlg" Control="Back" Property="BackDialog" Value="{}"/>
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog1">NOT A AND NOT B</Publish>
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog2">A AND NOT B</Publish>
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog3">A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
    Property="BackDialog" Value="Dialog4">NOT A AND B</Publish>
<Publish Dialog="MyDlg" Control="Back"
    Event="NewDialog" Value="[BackDialog]">BackDialog</Publish>

--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Richard-45

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink

In article <[hidden email]>,
    "little.forest" <[hidden email]>  writes:

> "Additionally, you can't have more than one NewDialog control event
> on a button, even if the conditions are mutually exclusive."

At one point I found this buried in the MSI documentation; I don't
recall where it was offhand, but we had a series of dialogs with
complex conditional transitions between them.  Occasionally, buttons
would just cease to work and the dialog sequence was hung.
Eventually we tracked it back to this constraint.  Once we went the
route of using a property to specify the target dialog and changed
everything to only a single NewDialog event per control, then
everything worked properly again.

The annoying thing is that it will *appear* to work until it doesn't
and there's no unifying principle as to when it will work and when it
won't.  Its a little more work to do things through the property, but
it is guaranteed to work every single time that way.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Richard-45

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by little.forest

In article <[hidden email]>,
    "little.forest" <[hidden email]>  writes:

> "Additionally, you can't have more than one NewDialog control event
> on a button, even if the conditions are mutually exclusive." - this is
> interesting. Ca n you tell me where this fact comes from?

Found it.

Its in the docs for the ControlEvent table.

<http://msdn.microsoft.com/en-us/library/aa368037(VS.85).aspx>

        "The exception is that each control can publish a most one
        NewDialog or one SpawnDialog event."
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
Wow, you found it. Many thanks Richard.


"The annoying thing is that it will *appear* to work until it doesn't
and there's no unifying principle as to when it will work and when it
won't.  Its a little more work to do things through the property, but
it is guaranteed to work every single time that way.  " - yes, it's really annoying.



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Wednesday, October 21, 2009 9:01:14 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page


In article <[hidden email]>,
    "little.forest" <[hidden email]>  writes:

> "Additionally, you can't have more than one NewDialog control event
> on a button, even if the conditions are mutually exclusive." - this is
> interesting. Ca n you tell me where this fact comes from?

Found it.

Its in the docs for the ControlEvent table.

<http://msdn.microsoft.com/en-us/library/aa368037(VS.85).aspx>

    "The exception is that each control can publish a most one
    NewDialog or one SpawnDialog event."
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Blair-2
Hi Blair,


As what I mentioned, since our old 2.0 product's uninstaller deletes settings but not remove the setting folder, there is a chance that the setting folder is empty. So we can't detect folder but have to detect *.* by writing a DLL. Anyways, I wrote a small dll and integrated it in the installer. But from the log, the dll is never run. Could you please point out the problem? Here is the Wix code:
<Property Id="NEED_MIGRATE_SETTING" Secure="yes"/>
<Binary Id="DetectSettingMigrationBin" SourceFile="DetectSM.dll" />
<CustomAction Id="DetectSettingMigrationCA" BinaryKey="DetectSettingMigrationBin" DllEntry="DetectSM" Execute="firstSequence"/>
<InstallExecuteSequence>
<Custom Action="DetectSettingMigrationCA" After="AppSearch" />
</InstallExecuteSequence>


In the dll, for testing purpose, I just set the property NEED_MIGRATE_SETTING as 1 for now. But I checked the log, the dll itself is never run.

Thanks.
/Brian.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset. <[hidden email]>
Sent: Tuesday, October 20, 2009 7:27:41 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page

Can you live with the existence (or lack thereof) of those two settings
directories? Does it matter if they are empty or not? I would assume that if
the 3.0 one didn't exist but the 2.0 one does, you have a better than even
chance you have data to upgrade. Anytime you can use a built-in custom
action instead of supplying your own, you tend to improve reliability.
However, you can add as many custom actions (and custom action binaries)
into your installation package as you wish, up to the size limit of the MSI
file (not that you would ever want an MSI file that big).

I assume your "AppData" property is the APPDATA environment variable. If
not, change my "[%AppData]\" and ensure that the property is defined before
the AppSearch action. If it is defined in your Directory table, those
properties are not populated until CostFinalize. Note that if Windows
Installer defines a path, it always includes the trailing backslash ('\').
If you supply paths via your own custom action, you should do the same.

<Property Id="SETTINGS_20_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 2.0" Depth="0"/>
</Property>
<Property Id="SETTINGS_30_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 3.0" Depth="0"/>
</Property>

<Property Id="NEED_UPGRADE_SETTING" Secure="yes"/>
<CustomAction Id="SetNeedUpgradeSetting" Property="NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<InstallUISequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom>
</InstallUISequence>

If you can't use mere absence/presence of the folders for your detection
routine, don't use any of my code (except for the secure property
declaration of NEED_UPDRADE_SETTING) and instead set NEED_UPDRADE_SETTING in
your DLL action. Call your action with no condition in your
InstallUISequence where I call SetNeedUpgradeSetting.

Now, on to the InstallExecuteSequence. I am assuming that your confirmation
dialog (MyDlg) has a check box that is associated with the property
REALLY_NEED_UPGRADE_SETTING (which sets it to the value "1" if the box is
checked). What is your default? Also, if the UI is bypassed, what should the
assumed value be? I hope it is the same (checked by default, assumed checked
if never shown). That makes your logic easier.

You will need to make sure your REALLY_NEED_UPGRADE_SETTING property is also
secure. I will assume it is also checked by default. If you are using your
DLL instead of simple folder detection you should also set it to
Execute="firstSequence".

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes" Value="1"/><!--
remove 'Value="1"' but leave the rest if migrating settings is NOT the
default action-->

<InstallExecuteSequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom><!--Note that this is identical to
InstallUISequence. That is by design.-->
  <Custom Action="DoSettingUpgrade" Before="InstallFinalize">NOT Installed
AND REALLY_NEED_UPGRADE_SETTING AND NEED_UPGRADE_SETTING</Custom><!-- you
may consider removing "NOT Installed AND " from this condition. Then repairs
and minor upgrades will restore your 3.0 settings from the 2.0 ones if they
are "lost"-->
</InstallExecuteSequence>

If your default action and your opt-in/-out experience are different, you
will have a bit more complicated logic story, but I will leave that unless
you need help with that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 5:40 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Hi Blair,


Thank you so much. I really appreciate your detailed reply. The code example
you provided is clear and neat.

Basically, we'd like to do these:
1. Detect if we need to do a setting migration: look into
"[AppData]\MyCompany\MyApp 3.0" folder and "[AppData]\MyCompany\MyApp 2.0"
folder. If there is nothing in 3.0 folder(it means the user never install
the 3.0 version) and there is something in 2.0 folder(it means the user ever
used 2.0 version), then we should do setting upgrade. We'll need to set a
property.
2. If the property is set, then we'll need to do setting upgrade. We'll show
a new page after InstallDirDlg and before VerifyReadyDlg. In this page,
we'll say "We have detected you have 2.0 settings. Do you want to upgrade
these settings to 3.0?", and provide a checkbox.
If the property is not set, we do not show this setting migration page.
3. After installation but before it's finished, based on the property, we'll
either run a small program to migrate settings, or do nothing.

So from these description, hopefully you've got our logic: we need to
"detect->set property->show message on GUI->do setting migration".

Our setting folder structure is a bit of complicated. The setting folder may
contain files(like settings.xml, or ui.xml), or may contain user's
login(like "james" or "linda"). So when doing detection, we really couldn't
count on a specific file. What we really need is to detect "*.*" which isn't
supported by MSI. So I guess I'll have to write a DLL to do the detection
work? Inside the DLL, I'll look into the source and destination folder and
set property, right?

For display on GUI, with your code example and a lot of google searching and
trying, I've got it work. Here is the code for dialog sequence, please point
out errors if you find there is any:
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING="1"]]></Publish>
            <Publish Dialog="MyInstallDirDlg" Control="Next"
Event="NewDialog" Value="VerifyReadyDlg"
Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING<>"1"]]></Publish>


<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed and NOT
NEED_UPGRADE_SETTING</Publish>


I made some testing, it seems working: if I explicitly set
NEED_UPGRADE_SETTING property in my code, I did see the message page; if I
don't, then I didn't see the page. So it's good.

So my goal is to look into the DLL which can detect if need to migrate
setting and set the property. I'll get on it.

But there are still two things I'm not sure:
1. As you know, we have an EXE program to handle the setting migration. Is
it okay to include both the detection DLL and the upgrade program EXE in one
installer? Here is our setting upgrade program code part:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>
            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
                          Execute="deferred"
                          Return="check"
                          HideTarget="no"
                          Impersonate="no" />


<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

2. How to make the detection happen before the actual setting migration
program?

Am I doing the right thing? Or am I in the right direction? Please let me
know.

Thanks again,
/Brian




________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 4:55:54 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

I don't know the logic you are looking for, but here is one possibility (may
not be your correct logic, but if you can read this, check the
documentation, and determine what it will do, you should then understand
what you need to do to implement the logic you are looking for.

<Property Id="NEED_UPGRADE_SETTING" Secure="yes">
  <DirectorySearch Id="MyFileFolder" Path="C:\My\Files\Folder"
AssignToProperty="yes">
    <FileSearch Name="MyFile.ext"/>
  </DirectorySearch>
</Property>

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes">
<CustomAction Id="SetMyProperty" Property="REALLY_NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">Installed or NOT
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="WelcomeDlg" Order="1">Installed or NOT NEED_UPGRADE_SETTING</Publish>

<InstallUISequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>

If you can describe the logic (including UI) you are looking for and a way
to use file/directory/registry/MSI component searches to determine your need
to perform the upgrade, we can help you craft that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 3:23 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't
translate your instructions to be actual code and make it work. Is it
possible to provide some step by step instructions? I'd just like it more
specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a
newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
Did you try scheduling the custom action in both InstallUISequence as well
as InstallExecuteSequence?

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Friday, October 23, 2009 5:01 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Hi Blair,


As what I mentioned, since our old 2.0 product's uninstaller deletes
settings but not remove the setting folder, there is a chance that the
setting folder is empty. So we can't detect folder but have to detect *.* by
writing a DLL. Anyways, I wrote a small dll and integrated it in the
installer. But from the log, the dll is never run. Could you please point
out the problem? Here is the Wix code:
<Property Id="NEED_MIGRATE_SETTING" Secure="yes"/>
<Binary Id="DetectSettingMigrationBin" SourceFile="DetectSM.dll" />
<CustomAction Id="DetectSettingMigrationCA"
BinaryKey="DetectSettingMigrationBin" DllEntry="DetectSM"
Execute="firstSequence"/>
<InstallExecuteSequence>
<Custom Action="DetectSettingMigrationCA" After="AppSearch" />
</InstallExecuteSequence>


In the dll, for testing purpose, I just set the property
NEED_MIGRATE_SETTING as 1 for now. But I checked the log, the dll itself is
never run.

Thanks.
/Brian.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 7:27:41 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Can you live with the existence (or lack thereof) of those two settings
directories? Does it matter if they are empty or not? I would assume that if
the 3.0 one didn't exist but the 2.0 one does, you have a better than even
chance you have data to upgrade. Anytime you can use a built-in custom
action instead of supplying your own, you tend to improve reliability.
However, you can add as many custom actions (and custom action binaries)
into your installation package as you wish, up to the size limit of the MSI
file (not that you would ever want an MSI file that big).

I assume your "AppData" property is the APPDATA environment variable. If
not, change my "[%AppData]\" and ensure that the property is defined before
the AppSearch action. If it is defined in your Directory table, those
properties are not populated until CostFinalize. Note that if Windows
Installer defines a path, it always includes the trailing backslash ('\').
If you supply paths via your own custom action, you should do the same.

<Property Id="SETTINGS_20_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 2.0" Depth="0"/>
</Property>
<Property Id="SETTINGS_30_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 3.0" Depth="0"/>
</Property>

<Property Id="NEED_UPGRADE_SETTING" Secure="yes"/>
<CustomAction Id="SetNeedUpgradeSetting" Property="NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<InstallUISequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom>
</InstallUISequence>

If you can't use mere absence/presence of the folders for your detection
routine, don't use any of my code (except for the secure property
declaration of NEED_UPDRADE_SETTING) and instead set NEED_UPDRADE_SETTING in
your DLL action. Call your action with no condition in your
InstallUISequence where I call SetNeedUpgradeSetting.

Now, on to the InstallExecuteSequence. I am assuming that your confirmation
dialog (MyDlg) has a check box that is associated with the property
REALLY_NEED_UPGRADE_SETTING (which sets it to the value "1" if the box is
checked). What is your default? Also, if the UI is bypassed, what should the
assumed value be? I hope it is the same (checked by default, assumed checked
if never shown). That makes your logic easier.

You will need to make sure your REALLY_NEED_UPGRADE_SETTING property is also
secure. I will assume it is also checked by default. If you are using your
DLL instead of simple folder detection you should also set it to
Execute="firstSequence".

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes" Value="1"/><!--
remove 'Value="1"' but leave the rest if migrating settings is NOT the
default action-->

<InstallExecuteSequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom><!--Note that this is identical to
InstallUISequence. That is by design.-->
  <Custom Action="DoSettingUpgrade" Before="InstallFinalize">NOT Installed
AND REALLY_NEED_UPGRADE_SETTING AND NEED_UPGRADE_SETTING</Custom><!-- you
may consider removing "NOT Installed AND " from this condition. Then repairs
and minor upgrades will restore your 3.0 settings from the 2.0 ones if they
are "lost"-->
</InstallExecuteSequence>

If your default action and your opt-in/-out experience are different, you
will have a bit more complicated logic story, but I will leave that unless
you need help with that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 5:40 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Hi Blair,


Thank you so much. I really appreciate your detailed reply. The code example
you provided is clear and neat.

Basically, we'd like to do these:
1. Detect if we need to do a setting migration: look into
"[AppData]\MyCompany\MyApp 3.0" folder and "[AppData]\MyCompany\MyApp 2.0"
folder. If there is nothing in 3.0 folder(it means the user never install
the 3.0 version) and there is something in 2.0 folder(it means the user ever
used 2.0 version), then we should do setting upgrade. We'll need to set a
property.
2. If the property is set, then we'll need to do setting upgrade. We'll show
a new page after InstallDirDlg and before VerifyReadyDlg. In this page,
we'll say "We have detected you have 2.0 settings. Do you want to upgrade
these settings to 3.0?", and provide a checkbox.
If the property is not set, we do not show this setting migration page.
3. After installation but before it's finished, based on the property, we'll
either run a small program to migrate settings, or do nothing.

So from these description, hopefully you've got our logic: we need to
"detect->set property->show message on GUI->do setting migration".

Our setting folder structure is a bit of complicated. The setting folder may
contain files(like settings.xml, or ui.xml), or may contain user's
login(like "james" or "linda"). So when doing detection, we really couldn't
count on a specific file. What we really need is to detect "*.*" which isn't
supported by MSI. So I guess I'll have to write a DLL to do the detection
work? Inside the DLL, I'll look into the source and destination folder and
set property, right?

For display on GUI, with your code example and a lot of google searching and
trying, I've got it work. Here is the code for dialog sequence, please point
out errors if you find there is any:
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING="1"]]></Publish>
            <Publish Dialog="MyInstallDirDlg" Control="Next"
Event="NewDialog" Value="VerifyReadyDlg"
Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING<>"1"]]></Publish>


<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed and NOT
NEED_UPGRADE_SETTING</Publish>


I made some testing, it seems working: if I explicitly set
NEED_UPGRADE_SETTING property in my code, I did see the message page; if I
don't, then I didn't see the page. So it's good.

So my goal is to look into the DLL which can detect if need to migrate
setting and set the property. I'll get on it.

But there are still two things I'm not sure:
1. As you know, we have an EXE program to handle the setting migration. Is
it okay to include both the detection DLL and the upgrade program EXE in one
installer? Here is our setting upgrade program code part:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>
            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
                          Execute="deferred"
                          Return="check"
                          HideTarget="no"
                          Impersonate="no" />


<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

2. How to make the detection happen before the actual setting migration
program?

Am I doing the right thing? Or am I in the right direction? Please let me
know.

Thanks again,
/Brian




________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 4:55:54 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

I don't know the logic you are looking for, but here is one possibility (may
not be your correct logic, but if you can read this, check the
documentation, and determine what it will do, you should then understand
what you need to do to implement the logic you are looking for.

<Property Id="NEED_UPGRADE_SETTING" Secure="yes">
  <DirectorySearch Id="MyFileFolder" Path="C:\My\Files\Folder"
AssignToProperty="yes">
    <FileSearch Name="MyFile.ext"/>
  </DirectorySearch>
</Property>

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes">
<CustomAction Id="SetMyProperty" Property="REALLY_NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">Installed or NOT
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="WelcomeDlg" Order="1">Installed or NOT NEED_UPGRADE_SETTING</Publish>

<InstallUISequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>

If you can describe the logic (including UI) you are looking for and a way
to use file/directory/registry/MSI component searches to determine your need
to perform the upgrade, we can help you craft that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 3:23 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't
translate your instructions to be actual code and make it work. Is it
possible to provide some step by step instructions? I'd just like it more
specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a
newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Make your browsing faster, safer, and easier with the new Internet ExplorerR
8. Optimized for Yahoo! Get it Now for Free! at
http://downloads.yahoo.com/ca/internetexplorer/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
Aha, you're right. I didn't schedule the CA in InstallUISequence.

Sorry.
After add it in InstallUISequence, it seems working.

Thanks and have a good weekend!
/Brian



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset. <[hidden email]>
Sent: Friday, October 23, 2009 5:34:05 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page

Did you try scheduling the custom action in both InstallUISequence as well
as InstallExecuteSequence?

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Friday, October 23, 2009 5:01 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Hi Blair,


As what I mentioned, since our old 2.0 product's uninstaller deletes
settings but not remove the setting folder, there is a chance that the
setting folder is empty. So we can't detect folder but have to detect *.* by
writing a DLL. Anyways, I wrote a small dll and integrated it in the
installer. But from the log, the dll is never run. Could you please point
out the problem? Here is the Wix code:
<Property Id="NEED_MIGRATE_SETTING" Secure="yes"/>
<Binary Id="DetectSettingMigrationBin" SourceFile="DetectSM.dll" />
<CustomAction Id="DetectSettingMigrationCA"
BinaryKey="DetectSettingMigrationBin" DllEntry="DetectSM"
Execute="firstSequence"/>
<InstallExecuteSequence>
<Custom Action="DetectSettingMigrationCA" After="AppSearch" />
</InstallExecuteSequence>


In the dll, for testing purpose, I just set the property
NEED_MIGRATE_SETTING as 1 for now. But I checked the log, the dll itself is
never run.

Thanks.
/Brian.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 7:27:41 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Can you live with the existence (or lack thereof) of those two settings
directories? Does it matter if they are empty or not? I would assume that if
the 3.0 one didn't exist but the 2.0 one does, you have a better than even
chance you have data to upgrade. Anytime you can use a built-in custom
action instead of supplying your own, you tend to improve reliability.
However, you can add as many custom actions (and custom action binaries)
into your installation package as you wish, up to the size limit of the MSI
file (not that you would ever want an MSI file that big).

I assume your "AppData" property is the APPDATA environment variable. If
not, change my "[%AppData]\" and ensure that the property is defined before
the AppSearch action. If it is defined in your Directory table, those
properties are not populated until CostFinalize. Note that if Windows
Installer defines a path, it always includes the trailing backslash ('\').
If you supply paths via your own custom action, you should do the same.

<Property Id="SETTINGS_20_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 2.0" Depth="0"/>
</Property>
<Property Id="SETTINGS_30_EXIST" Secure="yes">
  <DirectorySearch Id="[%AppData]\MyCompany\MyApp 3.0" Depth="0"/>
</Property>

<Property Id="NEED_UPGRADE_SETTING" Secure="yes"/>
<CustomAction Id="SetNeedUpgradeSetting" Property="NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<InstallUISequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom>
</InstallUISequence>

If you can't use mere absence/presence of the folders for your detection
routine, don't use any of my code (except for the secure property
declaration of NEED_UPDRADE_SETTING) and instead set NEED_UPDRADE_SETTING in
your DLL action. Call your action with no condition in your
InstallUISequence where I call SetNeedUpgradeSetting.

Now, on to the InstallExecuteSequence. I am assuming that your confirmation
dialog (MyDlg) has a check box that is associated with the property
REALLY_NEED_UPGRADE_SETTING (which sets it to the value "1" if the box is
checked). What is your default? Also, if the UI is bypassed, what should the
assumed value be? I hope it is the same (checked by default, assumed checked
if never shown). That makes your logic easier.

You will need to make sure your REALLY_NEED_UPGRADE_SETTING property is also
secure. I will assume it is also checked by default. If you are using your
DLL instead of simple folder detection you should also set it to
Execute="firstSequence".

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes" Value="1"/><!--
remove 'Value="1"' but leave the rest if migrating settings is NOT the
default action-->

<InstallExecuteSequence>
  <Custom Action="SetNeedUpgradeSetting" After="AppSearch">SETTINGS_20_EXIST
AND NOT SETTINGS_30_EXIST</Custom><!--Note that this is identical to
InstallUISequence. That is by design.-->
  <Custom Action="DoSettingUpgrade" Before="InstallFinalize">NOT Installed
AND REALLY_NEED_UPGRADE_SETTING AND NEED_UPGRADE_SETTING</Custom><!-- you
may consider removing "NOT Installed AND " from this condition. Then repairs
and minor upgrades will restore your 3.0 settings from the 2.0 ones if they
are "lost"-->
</InstallExecuteSequence>

If your default action and your opt-in/-out experience are different, you
will have a bit more complicated logic story, but I will leave that unless
you need help with that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 5:40 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Hi Blair,


Thank you so much. I really appreciate your detailed reply. The code example
you provided is clear and neat.

Basically, we'd like to do these:
1. Detect if we need to do a setting migration: look into
"[AppData]\MyCompany\MyApp 3.0" folder and "[AppData]\MyCompany\MyApp 2.0"
folder. If there is nothing in 3.0 folder(it means the user never install
the 3.0 version) and there is something in 2.0 folder(it means the user ever
used 2.0 version), then we should do setting upgrade. We'll need to set a
property.
2. If the property is set, then we'll need to do setting upgrade. We'll show
a new page after InstallDirDlg and before VerifyReadyDlg. In this page,
we'll say "We have detected you have 2.0 settings. Do you want to upgrade
these settings to 3.0?", and provide a checkbox.
If the property is not set, we do not show this setting migration page.
3. After installation but before it's finished, based on the property, we'll
either run a small program to migrate settings, or do nothing.

So from these description, hopefully you've got our logic: we need to
"detect->set property->show message on GUI->do setting migration".

Our setting folder structure is a bit of complicated. The setting folder may
contain files(like settings.xml, or ui.xml), or may contain user's
login(like "james" or "linda"). So when doing detection, we really couldn't
count on a specific file. What we really need is to detect "*.*" which isn't
supported by MSI. So I guess I'll have to write a DLL to do the detection
work? Inside the DLL, I'll look into the source and destination folder and
set property, right?

For display on GUI, with your code example and a lot of google searching and
trying, I've got it work. Here is the code for dialog sequence, please point
out errors if you find there is any:
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING="1"]]></Publish>
            <Publish Dialog="MyInstallDirDlg" Control="Next"
Event="NewDialog" Value="VerifyReadyDlg"
Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and
NEED_UPGRADE_SETTING<>"1"]]></Publish>


<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back"
Event="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed and NOT
NEED_UPGRADE_SETTING</Publish>


I made some testing, it seems working: if I explicitly set
NEED_UPGRADE_SETTING property in my code, I did see the message page; if I
don't, then I didn't see the page. So it's good.

So my goal is to look into the DLL which can detect if need to migrate
setting and set the property. I'll get on it.

But there are still two things I'm not sure:
1. As you know, we have an EXE program to handle the setting migration. Is
it okay to include both the detection DLL and the upgrade program EXE in one
installer? Here is our setting upgrade program code part:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>
            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
                          Execute="deferred"
                          Return="check"
                          HideTarget="no"
                          Impersonate="no" />


<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

2. How to make the detection happen before the actual setting migration
program?

Am I doing the right thing? Or am I in the right direction? Please let me
know.

Thanks again,
/Brian




________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 4:55:54 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

I don't know the logic you are looking for, but here is one possibility (may
not be your correct logic, but if you can read this, check the
documentation, and determine what it will do, you should then understand
what you need to do to implement the logic you are looking for.

<Property Id="NEED_UPGRADE_SETTING" Secure="yes">
  <DirectorySearch Id="MyFileFolder" Path="C:\My\Files\Folder"
AssignToProperty="yes">
    <FileSearch Name="MyFile.ext"/>
  </DirectorySearch>
</Property>

<Property Id="REALLY_NEED_UPGRADE_SETTING" Secure="yes">
<CustomAction Id="SetMyProperty" Property="REALLY_NEED_UPGRADE_SETTING"
Value="1" Execute="firstSequence"/>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">Installed or NOT
NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="MyDlg" Order="1">NOT Installed and NEED_UPGRADE_SETTING</Publish>

<Publish Dialog="MyInstallDirDlg" Control="Last" Event="NewDialog"
Value="WelcomeDlg" Order="1">Installed or NOT NEED_UPGRADE_SETTING</Publish>

<InstallUISequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="SetMyProperty"
Before="WelcomeDlg">NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>

If you can describe the logic (including UI) you are looking for and a way
to use file/directory/registry/MSI component searches to determine your need
to perform the upgrade, we can help you craft that.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 3:23 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks Blair.


Frankly, I'm not getting what you just said. I'm afraid that I couldn't
translate your instructions to be actual code and make it work. Is it
possible to provide some step by step instructions? I'd just like it more
specific.

(Even I've being dealt with Wix for more then 10 months, I'd say I'm still a
newbie. Forgive me, please.)

Thanks anyway.



________________________________
From: Blair <[hidden email]>
To: General discussion for Windows Installer XML toolset.
<[hidden email]>
Sent: Tuesday, October 20, 2009 3:05:32 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

"Type 19" is <CustomAction Property='PROPID' Value='My Value
[WITHPROPERTIES] if needed'/>
You schedule it in the sequence tables like any other custom action,
including using conditions.

And, yes, on your "conditions to determine dialogs" question.

-----Original Message-----
From: little.forest [mailto:[hidden email]]
Sent: Tuesday, October 20, 2009 12:56 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page

Thanks for your reply, Richard.


Hmm, can you tell me how to use AppSearch to "locate folders"?

"Use type 19 CA to set properties" - I guess you mean I'll need a dll or exe
to detect and set the property, right? If so, is it possible that I can
"reuse" my existing setting upgrade program? I already have a small program
to handle setting upgrade - it accepts parameters to run like this
"upgrade_settings.exe -run param1 param2". Can I run it something like
"upgrade_settings.exe -detect param1 param2" just for detection reason? How
can I make sure this detection run is before the actual setting upgrade
running? I've a feeling that, for one program, we'd better not to run it
twice in one installer. Or, even I can write another program to do the
detection work, but how can I sequence these two apps to make the detection
one run first? Maybe I'm wrong, but I worry about the program sequencing.
Currently, I have these code:
            <Binary Id="SettingUpgraderApp"
SourceFile="upgrade_settings.exe"/>

            <CustomAction Id="DoSettingUpgrade"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-run param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="DoSettingUpgrade"
Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


If, say, add the detection, can I do this?
            <CustomAction Id="SettingUpgradeDetection"
                          BinaryKey="SettingUpgraderApp"
                          ExeCommand='-detect param1 param2'
Execute="deferred"
Return="check"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
                <Custom Action="SettingUpgradeDetection"
Before="DoSettingUpgrade">NOT Installed and
REALLY_NEED_UPGRADE_SETTING</Custom>
</InstallExecuteSequence>


And the last question, "to use condition on events to determine dialogs
shown in a wizard", is it some like this?
            <Publish Dialog="MyDlg" Control="Back" Event="NewDialog"
Value="MyInstallDirDlg" Order="1">NOT Installed and and
REALLY_NEED_UPGRADE_SETTING</Publish>


Thanks!



________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Monday, October 19, 2009 6:52:11 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show
a new added dialog page


Use AppSearch to locate folders.

Use type 19 CA's (property set) to set properties based on conditions

Use conditions on events to determine dialogs shown in a wizard
sequence, or a condition on the dialog action in the UI sequence to
conditionally display dialogs.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the
new Yahoo! Canada Messenger for the Web BETA at
http://ca.messenger.yahoo.com/webmessengerpromo.php
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Make your browsing faster, safer, and easier with the new Internet ExplorerR
8. Optimized for Yahoo! Get it Now for Free! at
http://downloads.yahoo.com/ca/internetexplorer/
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
little.forest

Re: How to detect files presence and conditionally show a new added dialog page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Richard-45
Hi Richard,


You're right. I did got some weird error by not using your approach for button control event when I went back and forth among those dialog pages.

So I tried your approach, the errors were gone. However, I'm getting some other new weird issues: every time I've to click the "Next" button or "Back" button 2 times to go next or go back, very strange. But after this two times of clicking, I can go back and forth without problem. What's wrong?

You know, I took the code from WixUI_InstallDir.wxs and renamed it as MyWixUI_InstallDir.wxs and used it in my project. I changed the code by using your example, here is my code:
<Publish Dialog="MyInstallDirDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">1</Publish>
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<!--My code start here-->
<Publish Dialog="MyInstallDirDlg" Control="Next" Property="InstallDirNextDialog" Value="{}"/>
<Publish Dialog="MyInstallDirDlg" Control="Next" Property="InstallDirNextDialog" Value="MyAddedConfirmDlg"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and NEED_MIGRATE_SETTING="1"]]></Publish>
<Publish Dialog="MyInstallDirDlg" Control="Next" Property="InstallDirNextDialog" Value="VerifyReadyDlg"><![CDATA[WIXUI_INSTALLDIR_VALID="1" and NEED_MIGRATE_SETTING<>"1"]]></Publish>
<Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog" Value="[InstallDirNextDialog]" Order="4">InstallDirNextDialog</Publish>
<!--My code end here-->
<Publish Dialog="MyInstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="MyInstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>


As you can see, I changed the "NewDialog"(Next button) from one line to be 4 lines of code. Is it correct? But I don't know how come I have to click the next button 2 times to go to the next page? Do I have to write all of those 4 conditions(Not A and Not B, A and B, Not A and B, A and Not B) as 4 publish elements? In my case, I only care about two cases(A and B, A and Not B), is it okay?

Thanks.
/Brian




________________________________
From: Richard <[hidden email]>
To: [hidden email]
Sent: Wednesday, October 21, 2009 9:01:14 PM
Subject: Re: [WiX-users] How to detect files presence and conditionally show a new added dialog page


In article <[hidden email]>,
    "little.forest" <[hidden email]>  writes:

> "Additionally, you can't have more than one NewDialog control event
> on a button, even if the conditions are mutually exclusive." - this is
> interesting. Ca n you tell me where this fact comes from?

Found it.

Its in the docs for the ControlEvent table.

<http://msdn.microsoft.com/en-us/library/aa368037(VS.85).aspx>

    "The exception is that each control can publish a most one
    NewDialog or one SpawnDialog event."
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
1 2