Phil, your sample code works for me as well. Off to see where mine is different...
On Mon, 2 Sep 2013 10:25:03 -0700, Phil Wilson wrote: > My dumb search works just fine - I can't see what the issue is. This works > for me: > > Sample.msi and thing.txt in the same directory. > > <Property Id="FILEEXISTS" Secure="yes"> > <DirectorySearch Id="CheckFileDir" Path="[SourceDir]" Depth="0"> <FileSearch > Id="CheckFile" > Name="thing.txt" /> </DirectorySearch> </Property> > > and a custom action in the execute sequence to display the value... > > <CustomAction Id="Msg" Script="vbscript">msgbox > session.property("FILEEXISTS")</CustomAction> > > The custom action correctly shows the file path, and a log of the install > shows: > > MSI (c) (28:38) [10:13:38:811]: PROPERTY CHANGE: Adding FILEEXISTS property. > Its value is > 'C:\Phil\MyDD\WiX Samples\thing.txt'. > > > So it does all work. I don't think an actual example with SourceDir was ever > posted for a sanity > check, but this is how to do it. > > Phil Wilson > > > On Mon, Sep 2, 2013 at 9:19 AM, Edwin Castro <0ptikgh...@gmx.us> wrote: > >> I searched for WiX FileSearch in same directory as MSI on google. The first >> hit [1] I received >> [2] includes a reply from Phil Wilson suggesting the SourceDir [3] or >> OriginalDatabase [4] >> (with some additional parsing) might work. >> >> >> [1] >> >> http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/How-to-get-the-current-directory- >> of-msi-is-running-from-td3058873.html >> [2] I find it frustrating that different people can receive different >> results. *sigh* >> [3] http://msdn.microsoft.com/en-us/library/aa371857.aspx [4] >> http://msdn.microsoft.com/en- >> us/library/aa370562.aspx >> >> -- >> Edwin G. Castro >> >> On 8/31/13 10:21 AM, Kai Peters wrote: >>> Hi Edwin, >>> >>> no need to be suspicious of Depth and AssignToProperty (firstly, >>> >> omitting them didn't improve >>> things, nor did I expect it to) as Depth can avoid unnecessary file >>> >> system traversal (don't know how >>> deep the search would go if no Depth is specified but would assume that >>> >> default should be 0); >>> AssignToProperty seems redundant to me as I would always expect the >>> >> innermost element of a nested >>> search to be assigned - but I just put it in here to make things >>> >> absolutely clear. >> >>> As I wrote (though not put in my example code) BOTH absolute and >>> >> variable path specifications fail - >>> I would never use absolute paths in production. >>> >>> The idea behind this search is simply that our customers' IT people >>> >> could place a configuration file >>> template beside our MSI and that during MSI execution this template >>> >> would be copied into its >>> destination. Since I cannot know from where IT will deploy our MSIs, I >>> >> have to figure it out on the >>> fly... >>> >>> And it's still failing - son if someone has an idea for me to look at, >>> >> I'd appreciate it.... >> >>> Thanks, >>> Kai >>> >>> >>> On Thu, 29 Aug 2013 13:47:19 -0700, Edwin Castro wrote: >>> >>>> I'm highly suspect of the values for the Path, Depth and AssignToProperty >>>> attributes in >>>> your DirectorySearch. >>>> >>>> The example sent by John Cooper, replicated below for convenience, >>>> >> didn't set >>>> AssignToProperty="no" nor Depth="0". >>>> >>>> <Fragment> >>>> <PropertyRef Id="INSTALLLOCATION" /> >>>> >>>> <Property Id="WEB_CONFIG_PATH" Secure="yes"> >>>> <DirectorySearch Id="InstallLocationSearch" Path="[INSTALLLOCATION]"> >>>> >> <DirectorySearch >>>> Id="WebFolderSearch" Path="Web"> >>>> <DirectorySearch Id="ContractFolderSearch" Path="2008"> >>>> >> <DirectorySearch Id="WebHostFolderSearch" >>>> Path="ProductName"> <FileSearch Id="WebConfigFileSearch" >>>> >> Name="Web.config" /> </DirectorySearch> >>>> </DirectorySearch> </DirectorySearch> </DirectorySearch> </Property> >>>> >> </Fragment> >> >>>> >>>> The Path value in your example is hard coded and that seems wrong to >>>> >> me. Even if you can >>>> guarantee that the MSI will ALWAYS reside at that location I believe >>>> >> that caching by Windows >>>> Installer will cause problems for you. >>>> >>>> My vague memory tells me that others have attempted this and couldn't >>>> >> reliably determine where >>>> the MSI was located in other to find a companion file located in the >>>> >> same directory. >> >>>> An obvious workaround is to provide the path to the companion file via >>>> >> a public property. >> >>>> -- >>>> Edwin G. Castro >>>> >>>> On 8/29/13 10:04 AM, K Peters wrote: >>>>> Hi, >>>>> >>>>> I am still struggling with my FileSearch - no matter what I try, it >>>>> >> always pops up the "File >>>>> does not exist next to MSI" message. I have tried using "SourceDir" as >>>>> >> well as the absolute >>>>> path to where both the MSI & the inifile reside - same negative >>>>> >> results. >> >>>>> Does anyone have an idea as to where I am screwing up...? Thanks, as >>>>> always, for any >>>>> pointers! >>>>> >>>>> >>>>> <Property Id="MASTERINIFILE_EXISTS"> >>>>> <DirectorySearch >>>>> Id="MI_DirSearch" >>>>> Path="C:\Wix_Installscripts\Release_3.1.3\Regular_Install\" Depth="0" >>>>> >> AssignToProperty="no"> >>>>> <FileSearch Id="MI_FileSearch" Name="Master.ini" /> </DirectorySearch> >>>>> >> </Property> >> >>>>> <Condition Message="File does not exist next to MSI"> <![CDATA[Installed >>>>> and not >>>>> MASTERINIFILE_EXISTS]]> </Condition> >>>>> >>>>> <Condition Message="File does exist next to MSI"> <![CDATA[Installed and >>>>> MASTERINIFILE_EXISTS]]> </Condition> >>>>> >> ------------------------------------------------------------------------------ >> Learn the latest- >> >>>>> -Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the >>>>> >> easy way to master current >>>>> and previous Microsoft technologies and advance your career. Get an >>>>> >> incredible 1,500+ hours of >>>>> step-by-step tutorial videos with LearnDevNow. Subscribe today and >>>>> >> save! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> >>>>> _______________________________________________ WiX-users mailing list >>>>> >> WiX- >>>>> us...@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> >>>> >> ------------------------------------------------------------------------------ >> Learn the latest- >> - >> >>>> Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy >>>> >> way to master current and >>>> previous Microsoft technologies and advance your career. Get an >>>> >> incredible 1,500+ hours of step- >>>> by-step tutorial videos with LearnDevNow. Subscribe today and save! >>>> >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> >>>> _______________________________________________ WiX-users mailing list >>>> >> WiX- >>>> us...@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >>> >>> >> ------------------------------------------------------------------------------ >> >>> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >>> Discover the easy way >>> to master current and previous Microsoft >>> >> technologies >>> and advance your career. Get an incredible 1,500+ hours of step-by-step >>> tutorial videos with >>> LearnDevNow. Subscribe today and save! >>> >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> >>> _______________________________________________ WiX-users mailing list WiX- >>> us...@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/wix-users >> >> >> ------------------------------------------------------------------------------ >> Learn the latest- >> -Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way >> to master current >> and previous Microsoft technologies and advance your career. Get an >> incredible 1,500+ hours of >> step-by-step tutorial videos with LearnDevNow. Subscribe today and save! >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> _______________________________________________ WiX-users mailing list WiX- >> us...@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> > ------------------------------------------------------------------------------ > Learn the latest-- > Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to > master current and > previous Microsoft technologies and advance your career. Get an incredible > 1,500+ hours of step- > by-step tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk > _______________________________________________ WiX-users mailing list WiX- > us...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users