17
votes

Every time I compile my installer the default installation directory is C:\Program Files\Company\Product and I don't seem to be able to change it. Here's what I got under Setup:

[Setup]
AppName=MyProduct
AppVerName=MyProduct
AppPublisher=Company
DefaultDirName=C:\MyStuff\Company\MyProduct
DefaultGroupName=Company\MyProduct
UninstallDisplayIcon={app}\MyProduct.exe
UninstallDisplayName=MyProduct Uninstall
PrivilegesRequired=poweruser
OutputDir=userdocs:Inno Setup Examples Output
OutputBaseFilename=Setup
DisableDirPage=false
DisableProgramGroupPage=true
VersionInfoCompany=Company Inc
VersionInfoProductName=MyProduct
AllowUNCPath=false

Based on the documentations, DefaultDirName should dictate the default install folder. But it doesn't.

My case in particular is that, I want to set the default install folder on x64 machines to C:\Program Files, but the installer always picks Program Files (x86) no matter what I put in the DefaultDirName.

2
For an x86 app, C:\Program Files (x86)` and C:\Program Files` are the same folder. - Deanna
If you have a 64-bit application then you should turn on 64-bit install mode, and then it will do what you seem to want. If you have a 32-bit application then Inno is already doing the right thing, and trying to force it to install to the 64-bit Program Files folder would be very bad. - Miral

2 Answers

30
votes

The last selected installation folder has the precedence before the DefaultDirName directive value if the UsePreviousAppDir directive is set to yes, which is by default. If you want to force the directory specified by the DefaultDirName to be selected, turn off the UsePreviousAppDir directive.

If you want to keep the functionality with the last directory, and just overcome this for your testing, simply uninstall the previous installation before you run the new built setup.

5
votes

Just add "UsePreviousAppDir=no" in your iss file:

[Setup]

...

UsePreviousAppDir=no