Some Components installing to the wrong directory
I have an install project with a number of components some of which need to be installed in different directories. I am using the MsiSetProperty function to change the path after prompting the user for the base path. Some of the components get sent to the user selected directory and some get dumped in the root of the C drive during installation. I created all of the components in the exact same way and some of work and some don't. Here is the InstallScript code I am using to set the base path:
szTitle = "";
szMsg = "Enter the path to the root of your website.";
nResult = SdAskDestPath( szTitle, szMsg, svWebRoot, 0 );
Any help is greatly appreciated.
Maybe some of your components are not having their path set correctly. If some of you changed paths work and others dont, maybe run a log and see where the components are acutally being installed to, and this will tell you whether your code is not setting the path correctly or somthing else is causing the problem.
You can use this to run a log..
msiexe /I "<package name.msi>" /L*V c:\log.txt
then search through this log for your files that are being placed in the wron directory.
use the fuction MsiSetTargetPath. This function sets the full target path for a folder, which is defined in the directory table before.
Hope this help
Thanks for the great suggestions. Real quick question, what do you pass to the MsiSetTargetPath function in the first parameter. I tried the global ISMSI_HANDLE which I thought was the handle to the current installer but I got a compile error. Do I need to setup a custom action? I'm new to that technique.
Thanks for the help
I think you are looking at the wrong documentation for writing your script. With the install script, it doesnt ask for a HANDLE for the first object, it asks for the path to the package file(i think :-).
The HANDLE is needed when you write a custom action outside the install script and in another piece of code (e.g c, c++) that compiles into a DLL or exe. Maybe you can use these actions inside install script as well but im not sure.
I think to get around your problem, use your original setup, with the property, but use a Contol event. Use SetTargetPath.
This is an action is set during the dialogs and will set a path for a property.
So what you would do is add an event SetTargetPath with argument of WEBROOT to the next button of your change path dialog. You do this buy moving to you dialogs section in install shield, selecting the correct dialog, click on the button you are using under behaviour, and then add a new event (SetTargetPath).