Hi all,
I've been struggling for two days trying to achieve something that I
believe simple (obvioulsy not for me...)
Here's some part of my code:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id="MyCompany" Name="Company">
<Directory Id="A_DIRECTORY_ID" Name="myProduct">
... install some stuff here ...
</Directory>
... close all directories
On an initial installation, the UI allows me to set the 'A_DIRECTORY_ID'
property to ... lets say E:\Program Files\Company\myProduct
On majors upgrades, the installer reads the registry (on the AppSearch
sequence) to retrieve a given key (that I have set on the initial
installation) and sets 'A_DIRECTORY_ID' with this value. So the upgrade
installed to new version at the same place the old version was installed.
Everything worked well ... untill I had to add some files in another
directory under 'Company'
ex:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id="MyCompany" Name="Company">
<Directory Id="ANOTHER_DIR_ID" Name="myProduct2">
.... install some file here ...
</Directory>
<Directory Id="A_DIRECTORY_ID" Name="myProduct">
... install some stuff here ...
</Directory>
... close all directories
The problem, here, is that since the initial installation or an upgrade
only setups the 'A_DIRECTORY_ID' property, 'myProduct2' will
systematically be created under C:\Program Files\Company instead of
E:\Program Files\Company (this is of course an example)
I've tried writing a Custom Action to set the 'ANOTHER_DIR_ID' by using
the 'A_DIRECTORY_ID' property. I used to MsiSetProperty function. But,
although the customaction is triggered, the log nevers tells me that the
'ANOTHER_DIR_ID' is changed by this.
Any idea?
Here are some snippets from my wix code:
-- the way I retrieve the 'A_DIRECTORY_ID' property on an upgrade --
<Property Id="A_DIRECTORY_ID">
<RegistrySearch Id="A_DIRECTORY_ID" Type="directory" Root="HKLM"
Key="Software\Company\MyKey" Name="RootDir" />
</Property>
<InstallExecuteSequence>
<AppSearch Before="RemoveExistingProducts" />
<RemoveExistingProducts After="FindRelatedProducts" />
</InstallExecuteSequence>
-- the way I triggered my custom action --
<CustomAction Id='SetApacheDirProperty' Property='SetApacheDir'
Value='A_DIRECTORY_ID=[A_DIRECTORY_ID]' />
<CustomAction Id='SetApacheDir' BinaryKey='apmwsinst.dll'
DllEntry='apm_get_webservice_parent_directory' Execute='deferred'
Return='ignore' />
<InstallExecuteSequence>
<Custom Action='SetApacheDirProperty' After='InstallInitialize' />
<Custom Action='SetApacheDir' After='SetApacheDirProperty' />
</InstallExecuteSequence>
The apm_get_webservice_parent_directory custom action reads the
'A_DIRECTORY_ID' property and builds the 'ANOTHER_DIR_ID' property (and
then calls MsiSetProperty)
Please Help ....
Thanks.
Fred
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users