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

MsiSetTargetPath, Immediate Action, UAC

In our installations, we call MsiSetTargetPath with the INSTALLDIR argument to programmatically set the install directory. This must be done in an immediate action in order to make this change earlier enough. However, it fails in Windows 7 because immediate actions don't run with elevated privileges and the folder to where the software is installed is only accessible by an administrator.

I need a solution to get around this problem. Here are some specific questions:
1. Is it possible to programmatically elevate privileges within my custom action before I call MsiSetTargetPath?
2. Is there an alternative way to set a directory path in an immediate action?
3. Is there a way to call MsiSetTargetPath so that it doesn't require write privileges to the path?

Thanks.
Labels (1)
0 Kudos
(3) Replies
Not applicable

You can use property (Type 51) or directory custom action (Type 35) to set the INSTALLDIR path.
Type 51 should be called before constfinalize,
Type35 should be called only after constfinalize
Check the MSDN for more info; http://msdn.microsoft.com/en-us/library/aa367852(VS.85).aspx


For win 7 administrative issues, change the “Required execution level” to administrator. You can find this option in “Media ->Release->Setup.exe”.
Also add property MSIDEPLOYMENTCOMPLIANT = 1 in property manager.
0 Kudos
sgoldstein
Level 6

Thanks for the help.

A couple of follow on questions:

1. I found "http://msdn.microsoft.com/en-us/libr...52(VS.85).aspx" last night and have been trying to use the public properties method. It seems to work in a limited fashion. More specifically, if I set a property INSTALLDIR, CostFinalize will correctly update the INSTALLDIR directory. However, any child directories of INSTALLDIR are not updated. Is there any way to have CostFinalize process directory changes recursively?
2. Does the Custom Action Type 51 recursively modify directories?

Thanks.

Scott
0 Kudos
sgoldstein
Level 6

I think I found the problem. I had the custom action in the execute sequence only. When I added to both the UI and execute sequences, things appear to be working. Have another problem later on, but I believe it to be unrelated.

Thanks.

Scott
0 Kudos