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 <os...@live.com>
To: General discussion for Windows Installer XML toolset. 
<wix-users@lists.sourceforge.net>
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:little.for...@ymail.com] 
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 <os...@live.com>
To: General discussion for Windows Installer XML toolset.
<wix-users@lists.sourceforge.net>
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:little.for...@ymail.com] 
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 <legal...@xmission.com>
To: wix-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to