Hi已经创建了一个安装程序,用于在用户级别安装应用程序。当我从cab文件中提取setup.exe并在本地运行时,它不会提示我输入UAC并正常安装并在用户上下文中安装。
应用程序和cab是数字签名的。
但是,当我使用单击安装程序安装相同的程序时,它会提示我输入UAC并在管理上下文中安装它。
有什么可以说明为什么同一个setup.exe的行为不同?
我该怎么做才能避免这种情况?
我希望我的应用程序安装在用户级别,没有管理权限?
发布于 2013-12-31 21:48:45
我猜setup.exe
是在触发UAC设置兼容性启发式。来自MSDN:
用户帐户控制:检测应用程序安装并提示提升 当检测到需要提升权限的应用程序安装包时,将提示用户输入管理用户名和密码。如果用户输入有效凭据,则操作将继续使用适用的权限。
Windows试图检测某些安装程序(例如,包含安装程序、安装程序、更新文件名的应用程序),并试图自动提升它们。微软将此作为兼容性黑客:
您可以通知Windows,您的应用程序应该以管理员身份运行而不是。为此,可以将asInvoker
选项添加到可执行文件的程序集清单中:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="client"
type="win32"
/>
<description>CodeJunkie Widget Installer</description>
<!-- Disable Setup elevation compatibility heuristics since we're named setup.exe -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
https://stackoverflow.com/questions/20517548
复制相似问题