PDA

View Full Version : Adding Root Level Folder


Dermot
06-06-2007, 02:40 PM
How do I add a root level folder? For example I need to create the folder C:\My Folder\. I cannot see a way to do this. I can only add it as a subfolder of the builtin root level folders.

Brett
06-06-2007, 02:55 PM
Dermot,

Windows Installer doesn't like doing that very much. In general, it is preferred that you use a mapped shell folder such as Program Files, etc.

However, if you really need to do that, here is how:

- Setup the project normally with INSTALLDIR being [ProgramFilesFolder]My Product (or whatever)
- Add a Set Folder custom action that sets INSTALLDIR to "C:\My Folder" (no quotes)
- In the attributes tab, set the scheduling to be Immediate - First Sequence
- Add two timing entries - one for InstallUISequence and one for InstallExecuteSequence - make them both happen After "CostFinalize" - also, use the condition "NOT Installed"

See the attached project file for an example

Lorne
06-06-2007, 03:13 PM
There's also a couple Windows Installer properties that might be useful in setting up your custom action or related folder search.

WindowsVolume - the drive where Windows is installed. Which is usually C: but not necessarily so.
ROOTDRIVE (http://msdn2.microsoft.com/En-US/library/aa371372.aspx) - the default destination drive for the installation. Can seem somewhat unpredictable if it isn't set explicitly since it isn't the first drive, it's the drive with the most free space.

Dermot
06-06-2007, 03:24 PM
Thanks Brett and Lorne. That was very helpfull. I think can achieve what I want now.