Did you ever write to the file? What OS are you on? If I had to guess,
you had triggered a write during a previous install on Windows 7/Vista,
so the file system virtualization has kicked in. Check in
C:\Users\%username%\AppData\Local\VirtualStore\Program Files
(x86)\Family\Application\Settings.config. If you do need to write values
to the XML file, you need to ensure your write call is not impersonated.


-----Original Message-----
From: ville.frantti [mailto:ville.fran...@softwave.fi] 
Sent: Tuesday, January 10, 2012 2:23 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Read existing settings in managed custom action

Hi.

I'm trying to open previous settings (XML file) from install location
and
set values to MSI properties. Installed location is initially set on
custom
action and it is searched in another CA. Managed custom action is
scheduled
after CostInitialize.

[SETTINGSFILE] property is initially set to C:\Program Files
(x86)\Family\Application\Settings.config if the search finds it.

GetCurrentSettings CA uses [SETTINGSFILE] property to open the settings
file. Basically everything works fine, but the file that gets opened is
not
the file that it should be. It is some kind of cached / temp version of
the
requested file.

I've tried to search the file that is opened, but can't find it
anywhere.
Original Settings.config file was contained in installer, removed it
from
installer and from every possible cache and temp folder, still the wrong
version gets opened even if there is no previous installation.

I've been battling over this for couple days now and can't find any
solution.
Any advice?

Managed custom action:
XmlDocument doc = new XmlDocument();
if (!string.IsNullOrEmpty(session["SETTINGSFILE"]){
        doc.Load(session["SETTINGSFILE"]);
        ...


Properties:
<Property Id="INSTALLEDDIR" Secure="yes"></Property>
<Property Id="SETTINGSFILE">
        <DirectorySearch Id="SearchInstallDirectory"
Path="[INSTALLEDDIR]">
                <FileSearch Id="SearchSettingsFile"
Name="Settings.config"/>
        </DirectorySearch>
</Property>


Custom actions:
<CustomAction Id="GetInstalledDir" Property="INSTALLEDDIR"
Value="[ProgramFilesFolder]$(var.Family)\$(var.Application)\" />
<CustomAction Id="GetCurrentSettings" BinaryKey="CustomActions"
DllEntry="GetCurrentSettings" Execute="immediate" />


UI Sequence:
<InstallUISequence>
        <Custom Action="GetInstalledDir" Before="AppSearch"></Custom>
        <Custom Action="GetCurrentSettings"
After="CostFinalize"></Custom>
        ... 

--
View this message in context:
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Read-exist
ing-settings-in-managed-custom-action-tp7171255p7171255.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------
------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create

new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to