MsiFormatRecord() could have been used to expand your value as well.

Note also that with [#File.Id] values, on maintenance transactions (such as
some minor upgrades and/or removals) it is possible for it to be blank.

-----Original Message-----
From: Nicolas Lambert [mailto:nlamb...@coveo.com] 
Sent: Monday, August 31, 2009 12:45 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] DTF context, can't access file using absolute path
with immediate custom action

Thx Blair.

I found the solution, I made a mistake, it was my fault.

I was setting a property for my customaction that had the value :
[#SearchWeb.config]. Since it was working okay for a deferred customaction,
I thought that there would be no problem for an immediate custom action
since they are a lot simpler having access to the MSI session...

I was wrong...

The value my custom action received was [#SearchWeb.config] and not
'C:\ProgramFiles\Coveo Enterprise Search 6\Web\Web.config' as I expected...
So, since it was not an absolute path, the method was completing for me,
adding the currentdirectory as the absolute path :
C:\Windows\Installer\MSI7FE0.tmp-\[#SearchWeb.config] and was not finding
the file [#SearchWeb.config] since, it indeed doesn't exist :S...

And since I was using Session.log to witness the content of my variables,
and since Session knew the value for [#SearchWeb.config] it sent me back
false information -> C:\Windows\Installer\MSI7FE0.tmp-\C:\ProgramFiles\Coveo
Enterprise Search 6\Web\Web.config'

So now I'm using the property defining the path directly from the registry
and everything is working.

Thanks for your time.

-----Original Message-----
From: Blair [mailto:os...@live.com] 
Sent: Thursday, August 27, 2009 5:04 PM
To: 'General discussion for Windows Installer XML toolset.'
Subject: Re: [WiX-users] DTF context, can't access file using absolute path
with immediate custom action

I don't know of this is it, but it looks like it might be (there is a page
on MSDN about relative and absolute URLs, and the XmlDocument.Load(string)
method expects a URL.

Try:
    string path = p_Session["MANAGED_SEARCHWEB_CONFIG_PATH"];
                p_Session.Log("cadata : " + path);

                XmlDocument config = new XmlDocument();
                p_Session.Log("xml doc created");

                config.Load("file://" + path);
                p_Session.Log("xml doc loaded");

-----Original Message-----
From: Nicolas Lambert [mailto:nlamb...@coveo.com] 
Sent: Thursday, August 27, 2009 12:32 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] DTF context, can't access file using absolute path with
immediate custom action

I've been working part time with WIX for a short time and I just began using
DTF to include a custom action in our install kit. I'm using an immediate
custom action and I just want to be able to read a file that has been
installed by a previous installation in the case of a major upgrade to
extract some information. However, whenever I try to access the file, the
path is internally modified by the method's call (config.Load(path); in the
code below but all methods I'm using seem to do this ) resulting in a none
existing path. I think it's due to the way DTF execute the CLR
"out-of-process" but I don't seem to understand how it's work... Could
someone explain what is happening and if what I want to do is possible ?
Since I'm not able to find any information concerning my problem I'm
beginning to think that the solution is simple and that I'm missing
something.

Thanks

Nicolas

Here is the concerned part of the log :

Action 11:17:51: BackUpSearchInterfaceWebConfig.
Action started 11:17:51: BackUpSearchInterfaceWebConfig.
MSI (s) (58:64) [11:17:51:986]: Creating MSIHANDLE (18) of type 790542 for
thread 356
MSI (s) (58:C0) [11:17:51:986]: Invoking remote custom action. DLL:
C:\Windows\Installer\MSI7FE0.tmp, Entrypoint: BackUpSearchInterfaceWebConfig
MSI (s) (58!44) [11:17:52:189]: Creating MSIHANDLE (19) of type 790531 for
thread 3908
SFXCA: Extracting custom action to temporary directory:
C:\Windows\Installer\MSI7FE0.tmp-\
MSI (s) (58!44) [11:17:52:189]: Closing MSIHANDLE (19) of type 790531 for
thread 3908
MSI (s) (58!44) [11:17:52:251]: Creating MSIHANDLE (20) of type 790531 for
thread 3908
SFXCA: Binding to CLR version v2.0.50727
MSI (s) (58!44) [11:17:52:251]: Closing MSIHANDLE (20) of type 790531 for
thread 3908
MSI (s) (58!44) [11:17:52:470]: Creating MSIHANDLE (21) of type 790531 for
thread 3908
Calling custom action
ManagedInstallerLib!ManagedInstallerLib.ManagedInstallerLib.BackUpSearchInte
rfaceWebConfig
MSI (s) (58!44) [11:17:52:470]: Closing MSIHANDLE (21) of type 790531 for
thread 3908
MSI (s) (58!44) [11:17:52:517]: Creating MSIHANDLE (22) of type 790531 for
thread 3908
cadata : C:\Program Files\Coveo Enterprise Search 6\Web\Web.config
MSI (s) (58!44) [11:17:52:517]: Closing MSIHANDLE (22) of type 790531 for
thread 3908
MSI (s) (58!44) [11:17:52:517]: Creating MSIHANDLE (23) of type 790531 for
thread 3908
MSI (s) (58!44) [11:17:52:517]: Closing MSIHANDLE (23) of type 790531 for
thread 3908
MSI (s) (58!44) [11:17:52:517]: Creating MSIHANDLE (24) of type 790531 for
thread 3908
xml doc created
MSI (s) (58!44) [11:17:52:517]: Closing MSIHANDLE (24) of type 790531 for
thread 3908
MSI (s) (58!44) [11:17:52:533]: Creating MSIHANDLE (25) of type 790531 for
thread 3908
Could not find file 'C:\Windows\Installer\MSI7FE0.tmp-\C:\Program
Files\Coveo Enterprise Search 6\Web\Web.config'.
MSI (s) (58!44) [11:17:52:533]: Closing MSIHANDLE (25) of type 790531 for
thread 3908
MSI (s) (58:C0) [11:17:52:548]: Closing MSIHANDLE (18) of type 790542 for
thread 356
Action ended 11:17:52: BackUpSearchInterfaceWebConfig. Return value 3.
Action ended 11:17:52: INSTALL. Return value 3.

And here is part of the code... Quite simple really...

    string path = p_Session["MANAGED_SEARCHWEB_CONFIG_PATH"];
                p_Session.Log("cadata : " + path);

                XmlDocument config = new XmlDocument();
                p_Session.Log("xml doc created");

                config.Load(path);
                p_Session.Log("xml doc loaded");

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to