The key here is to condition the custom action so that it only executes on a 
new install. The properties set as a result of the Upgrade table and 
FindRelatedProducts should help you determine if this is a new install or an 
upgrade.

Another alternative might be to require the user to provide the path to the 
directory in question. This way you avoid the problematic brute force lookup 
which might still result in not finding the previous application. You could 
have the user specify the directory in question on the command line as a public 
property or you could author a dialog to set a public property in the UI 
sequence. You might even still perform the expensive search if you are not 
upgrading _and_ the public property was not set.

The custom action itself is fairly simple. I just needs to traverse the entire 
file system until it finds the file it's looking for.

Edwin G. Castro
Software Developer - Staff
Electronic Banking Services
Fiserv
Office: 503-746-0643
Fax: 503-617-0291
www.fiserv.com
Please consider the environment before printing this e-mail

> -----Original Message-----
> From: Pally Sandher [mailto:pally.sand...@iesve.com]
> Sent: Friday, April 09, 2010 5:10 AM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Searching for existing files but only once
> 
> Well like I said, it won't ("the searching for the old application will
> always happen"). You can't do that without writing a Custom Action &
> Conditioning it appropriately as far as I know.
> Replace the function of the DirectorySearch with a Custom Action which
> returns the path to the directory containing your old application. Set
> the Property to that path & the rest of the code is still the same. You
> should be able to do that pretty easily using DTF.
> 
> Any chance you might start thinking for yourself sometime soon?
> 
> Palbinder Sandher
> Software Deployment & IT Administrator
> T: +44 (0) 141 945 8500
> F: +44 (0) 141 945 8501
> 
> http://www.iesve.com
> **Design, Simulate + Innovate with the <Virtual Environment>**
> Integrated Environmental Solutions Limited. Registered in Scotland No.
> SC151456
> Registered Office - Helix Building, West Of Scotland Science Park,
> Glasgow G20 0SP
> Email Disclaimer
> 
> -----Original Message-----
> From: Markus Karg [mailto:k...@quipsy.de]
> Sent: 09 April 2010 12:38
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Searching for existing files but only once
> 
> I do not understand how this will prevent that the DirectorySearch runs
> each time the MSI gets installed (which was actually what I liked to
> ask)?
> 
> > -----Original Message-----
> > From: Pally Sandher [mailto:pally.sand...@iesve.com]
> > Sent: Freitag, 9. April 2010 12:29
> > To: General discussion for Windows Installer XML toolset.
> > Subject: Re: [WiX-users] Searching for existing files but only once
> >
> > Something like the following should work:
> >
> > <Property Id="OLDAPPLICATION">
> >   <DirectorySearch Id="FindOldAppDir" AssignToProperty="yes"
> Depth="64"
> > Path="[ProgramFilesFolder]">
> >     <FileSearch Id="FindOldAppExe" Name="oldapp.exe" />
> >   </DirectorySearch>
> > </Property>
> >
> > <DirectoryRef Id="ProgramFilesFolder">
> >   <Directory Id="OLDAPPLICATION">
> >     <Component Id="A_Component" DiskId="1" Guid="A-GUID">
> >       <RemoveFile Id="Clean_A_Directory" Name="*" On="install"/>
> >       <RemoveFolder Id="Remove_A_Directory" On="install"/>
> >     </Component>
> >     <Directory Id="Another_Directory" Name="Another_Directory">
> >       <Component Id="Another_Component" DiskId="1"
> Guid="ANOTHER-GUID">
> >         <RemoveFile Id="Clean_Another_Directory" Name="*"
> > On="install"/>
> >         <RemoveFolder Id="Remove_Another_Directory" On="install"/>
> >       </Component>
> >     </Directory>
> >     ...
> >   </Directory>
> > </DirectoryRef>
> >
> > That assumes your old application will be under ProgramFilesFolder so
> > modify as appropriate.
> > You could condition the Feature for those components using something
> > like "NOT REINSTALL" so they don't run during patches or upgrades but
> > the searching for the old application will always happen (unless you
> > Condition AppSearch but that would stop your detecting of "new" MSI
> > setups for patching/upgrading).
> >
> > Palbinder Sandher
> > Software Deployment & IT Administrator
> > T: +44 (0) 141 945 8500
> > F: +44 (0) 141 945 8501
> >
> > http://www.iesve.com
> > **Design, Simulate + Innovate with the <Virtual Environment>**
> > Integrated Environmental Solutions Limited. Registered in Scotland
> No.
> > SC151456
> > Registered Office - Helix Building, West Of Scotland Science Park,
> > Glasgow G20 0SP Email Disclaimer
> >
> > -----Original Message-----
> > From: Markus Karg [mailto:k...@quipsy.de]
> > Sent: 08 April 2010 14:20
> > To: General discussion for Windows Installer XML toolset.
> > Subject: [WiX-users] Searching for existing files but only once
> >
> > We need to upgrade a preinstalled software. That software is very old
> > and knows nothing of MSI, Registry etc. We actually have to search
> all
> 
> > local drives for the old EXE file and remove the surrounding folder.
> As
> > this is a time consuming task, this shall only happen if this is
> really
> > an update of that old version but not if this is an update / upgrade
> /
> 
> > patch of a previous "new" MSI setup. I hope it is clear what I like
> to
> 
> > tell.
> >
> >
> >
> > We have no clue how to do that...
> >
> >
> >
> > Can anybody paste a short code snippet describing an idea how this
> > could be done?
> >
> >
> >
> > Thanks!
> >
> > Markus
> >
> >
> -----------------------------------------------------------------------
> > -
> > ------
> > Download Intel&#174; Parallel Studio Eval Try the new software tools
> > for yourself. Speed compiling, find bugs proactively, and fine-tune
> > applications for parallel performance.
> > See why Intel Parallel Studio got high marks during beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> >
> >
> >
> -----------------------------------------------------------------------
> > -------
> > Download Intel&#174; Parallel Studio Eval Try the new software tools
> > for yourself. Speed compiling, find bugs proactively, and fine-tune
> > applications for parallel performance.
> > See why Intel Parallel Studio got high marks during beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> -----------------------------------------------------------------------
> -
> ------
> Download Intel&#174; Parallel Studio Eval Try the new software tools
> for
> yourself. Speed compiling, find bugs proactively, and fine-tune
> applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 
> 
> -----------------------------------------------------------------------
> -------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to