Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 6

Setting Target Directory / Custom Actions

Using InstallScript MSI

I'm struggling with a very simple concept. I have one set of features that are installed to one user selected directory (INSTALLDIR) and I have another set of features I want installed to a different directory (USER_DIR2). What I can't figure out is when/how to set USER_DIR2 so the files are copied to the correct place.

I'm using MsiSetTargetPath to set the path but it is pretty clear I'm doing it at the wrong time/place. According to the log, the property gets changed but then it gets change back during CostFinalize.

I'm having a hard time getting a grip on all the custom action options as well as the ordering of actions. I thought setting a target path would be a good starting point to learn about them. Unfortunately, it has just lead to more confusion.
Labels (1)
0 Kudos
(2) Replies
Level 12

You will want to call MsiSetTargetPath after CostFinalize action. For additional info, please refer to Directory Table.

BTW, you may also use Custom Action Type 35 in lieu of MsiSetTargetPath.
0 Kudos
Level 6

I found the solution to my problem. My custom action was after CostFinalize but what I didn't realize is that components, as well as features, had destinations. I had changed the feature destination, but had not changed the component destination. Once I did this my custom action and MsiSetTargetPath worked as expected.

I'm still more than a bit confused/overwhelmed by all the MSI stuff but at least now I'm making some progress.
0 Kudos