简体   繁体   English

Inno Setup默认安装文件夹更改

[英]Inno Setup default install folder change

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. 每次我编译我的安装程序时,默认安装目录是C:\\ Program Files \\ Company \\ Product,我似乎无法更改它。 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. 根据文档,DefaultDirName应该指定默认安装文件夹。 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. 我的情况尤其是,我想将x64机器上的默认安装文件夹设置为C:\\ Program Files,但无论我在DefaultDirName中放置什么,安装程序总是选择Program Files(x86)。

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. 如果UsePreviousAppDir指令设置为yes (默认情况下),则最后选择的安装文件夹在DefaultDirName指令值之前具有优先级。 If you want to force the directory specified by the DefaultDirName to be selected, turn off the UsePreviousAppDir directive. 如果要强制选择DefaultDirName指定的目录,请关闭UsePreviousAppDir指令。

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. 如果要将功能保留在最后一个目录中,并且只是为了测试而克服这个问题,只需在运行新构建的安装程序之前卸载以前的安装。

Just add "UsePreviousAppDir=no" in your iss file: 只需在您的iss文件中添加“UsePreviousAppDir = no”:

[Setup] [设定]

... ...

UsePreviousAppDir=no UsePreviousAppDir =无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM