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


------------------------------------------------------------------------------
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



      __________________________________________________________________
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
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to