Inno Setup始终安装在管理员的AppData目录中 [英] Inno Setup always installs into admin's AppData directory

查看:188
本文介绍了Inno Setup始终安装在管理员的AppData目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的应用程序存储在当前用户的AppData目录中,以避免在自动更新应用程序时(存储在程序文件中)我们所拥有的权限出现问题.我们不会为用户提供将应用程序安装在何处的选项.非管理员用户抱怨我们,安装程序将应用程序存储在管理员的AppData目录中(当然是UAC之后),而不是当前用户的AppData目录,这将阻止该应用程序将来运行

I want to store my app in the current user's AppData directory to avoid problems with permissions we had when auto-updating our app (when it's stored in Program Files). We don't give the user the option of where to install the app. We've had complaints from non-admin users that the installer stores the app in the admin's AppData directory (after UAC of course), instead of the current user's AppData directory, which then prevents the app from running in the future.

首先,我有DefaultDirName={userappdata}\{#MyAppName}.然后我尝试了DefaultDirName={commonappdata}\{#MyAppName}.然后我尝试将其与PrivilegesRequired=lowest以及PrivilegesRequired=none一起作为

Firstly, I had DefaultDirName={userappdata}\{#MyAppName}. Then I tried DefaultDirName={commonappdata}\{#MyAppName}. Then I tried that along with PrivilegesRequired=lowest and even as PrivilegesRequired=none as the Make InnoSetup installer request privileges elevation only when needed question suggested.

这是我目前的脚本,以防万一我遗漏了一些明显的东西:

This is my script as of right now in case I'm missing something obvious:

; Script generated by the Inno Setup Script Wizard.
;SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Teamwork Chat"
#define MyAppVersion "0.10.0"
#define MyAppPublisher "Digital Crew, Ltd."
#define MyAppURL "http://www.teamwork.com/"
#define MyAppExeName "TeamworkChat.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{0F063485-F5AF-4ADE-A9F9-661AB3BAA661}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={userappdata}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
OutputDir=E:\chat-client\dist
OutputBaseFilename={#MyAppName}_for_Windows32_Installer-{#MyAppVersion}
SetupIconFile=E:\chat-client\icons\teamwork_chat.ico
WizardImageFile=E:\chat-client\icons\chatWizardImageFile.bmp
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "E:\chat-client\dist\TeamworkChat\win32\TeamworkChat.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\chat-client\dist\TeamworkChat\win32\ffmpegsumo.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\chat-client\dist\TeamworkChat\win32\icudtl.dat"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\chat-client\dist\TeamworkChat\win32\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\chat-client\dist\TeamworkChat\win32\libGLESv2.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\chat-client\dist\TeamworkChat\win32\nw.pak"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent


编辑

我已经更改了两个选项,但仍然没有运气;


Edit

I've changed two options but still no luck;

PrivilegesRequired=lowest
...
[Icons]
...
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

我添加了runasoriginaluser标志并生成了一个新的AppId(GUID),但仍然没有运气;

Edit 2:

I've added the runasoriginaluser flag and generated a new AppId (GUID) but still no luck;

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent runasoriginaluser

我已经创建了一个简单的 GitHub存储库带有源文件和Inno脚本.

Edit 3:

I've created a simple GitHub repository with the source files and Inno script.

我一直在Windows 8.1上进行测试.在Windows 7上编译并在Windows 8上运行时似乎可以正常工作,但是在8和8上运行时却无法正常工作.

I had been testing on Windows 8.1. It seems to work when compiled on Windows 7, and ran on Windows 8, but not when compiled on 8 and ran on 8.

现在已解决,但为了清除有关 Edit 4 的问题,它不仅在我的机器上工作.它可以在其他Windows 8计算机上使用.一定是某种奇怪的缓存之类的东西(即使我更改了AppId).

It's solved now but to clear things up regarding Edit 4, it wasn't working only on my machine. It worked on other Windows 8 machines. Must've been some weird caching or something (even though I changed the AppId).

推荐答案

从问题的措辞来看,如果我对您的理解正确,听起来这是因为您正在使用管理员帐户验证安装是否可以运行."如果是这种情况,并且您要在UAC提示符下输入其他帐户(与您登录时使用的帐户不同),则当前用户实际上将成为您刚刚在UAC提示符下输入的Administrator帐户,而不是您登录的帐户.在.因此,只要系统要求您使用UAC提升安装,它就不会最终出现在已登录用户的AppData目录中.

From the wording of your question and if I am understanding you correctly, it sounds like this is because you are "validating with an admin account for the install to run." If this is the case and you are entering a different account (from that which you are logged in with) at the UAC prompt, the current user then actually becomes the Administrator account you just entered at the UAC prompt and not the account you are logged in with. Therefore, as long as you are being asked to elevate the installation using UAC, it will not end up in the logged in user's AppData directory.

您可能需要做的是使用runasoriginaluser功能,该功能将使用登录的用户凭据而不是您在UAC提示符下输入的帐户,或者查找导致UAC海拔升高提示的原因.

What you may need to do is use the runasoriginaluser function, which will use the logged in user credentials instead of the account you entered at the UAC prompt, or find what is causing the UAC elevation prompt.

另请参见 Inno Setup为登录用户(非管理员用户)创建注册表项.

安装上下文也可能有用.

这篇关于Inno Setup始终安装在管理员的AppData目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆