Component destination path not updated
I found a strange behaviour with a component installed into a subdirectory and I'm not sure whether it's intended behaviour or a bug.
For example we have this configuration:
Main component destination: C:\a
Other component destination: C:\a\b\c\d
Directory Directory_Parent DefaultDir DIR_A TARGETDIR DIR_A DIR_B DIR_A b DIR_C DIR_B c DIR_D DIR_C d
So the main component was installed into DIR_A. DIR_A is looked up from the registry in AppSearch.
The other component's destination should always be relative to the main component, so the destination is set to DIR_D.
Imagine you'd install the main component to C:\x instead of C:\a.
At the beginning of the installation, DIR_A is set to the correct value of C:\x\ through AppSearch lookup.
DIR_B and DIR_C however are not set at this point.
Then in the logfile I can find:
PROPERTY CHANGE: Adding DIR_D property. Its value is 'C:\a\b\c\d'.
At this point I understand that the default path is used because lookup of the other pathes has not been done yet. It seems however that at this point, DIR_D is detached from the directory lookup (maybe because it's a destination directory).
Later in the logfile I can find:
PROPERTY CHANGE: Adding DIR_B property. Its value is 'C:\x\b\'. PROPERTY CHANGE: Adding DIR_C property. Its value is 'C:\x\b\c\'. PROPERTY CHANGE: Modifying DIR_D property. Its current value is 'C:\a\b\c\d'. Its new value: 'C:\a\b\c\d\'.
As you can see, DIR_D just got the \ added at the end, but it's path were not updated anymore.
Is this correct behaviour or should DIR_D usually be updated once its parent directories change?
Unfortunately due to this I have to set the directory manually (lookup of DIR_B and DIR_C through AppSearch is not possible because they don't exist yet at that time).
Additional info: Even changing the path later through MsiSetTargetPath doesn't help at all. According to the logfile, the property is updated correctly. However the component is still installed into the wrong directory.
Hi @Pizzamampf ,
I tried the same and I was not able to reproduce this.
For me all the files and sub folder/files were getting installed as per TARGETDIR location.
Also I tried setting DIR_A to INSTALLDIR.
Directory Directory_Parent DefaultDir DIR_A INSTALLDIR DIR_A DIR_B DIR_A b DIR_C DIR_B c DIR_D DIR_C d
During installation i have changed the installation dir to C:\Test. it successfully installed all the files and folder as per the above structure. i.e It created
Let me know if you have added any other related settings in the project.
Thank you for your response!
The complete project is much bigger. Actually INSTALLDIR points to a completely different location (the application has the INSTALLDIR and a "working directory", the latter is the one where I try to install the new component to).
The part for the new component (didn't exist in the setup but is added in update) is just as mentioned: Look up the working directory through AppSearch and then have several subfolders below.
In the meantime, at least I got a workaround running. While setting DIR_D through MsiSetTargetPath didn't work (it changed the property but not the actually used destination directory path), it finally works with a Set Directory custom action scheduled right after CostFinalize.