WiX安装后,我的exe文件无法通过双击运行,只能以管理员身份运行 [英] WiX after installation my exe file doesn't work by double click, only run as administrator work

查看:95
本文介绍了WiX安装后,我的exe文件无法通过双击运行,只能以管理员身份运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将此MSI软件包安装到%ProgramFiles%并为桌面文件夹创建快捷方式时,我将使用WiX准备一个MSI安装项目,该操作仅以管理员身份运行.双击时不起作用.当我在桌面上安装文件夹时,双击即可使用.我想安装到%ProgramFiles%并双击.请帮助我,我花了2周的时间进行安装.

我的代码在这里.

 <产品ID ="*" Name ="FlowNet Master"语言="1033" Version ="1.0.0.2"Manufacturer ="Melina-Aero" UpgradeCode ="PUT-GUID-HERE">< Package InstallerVersion ="200" Compressed ="yes" InstallScope ="perMachine" Platform ='x64'/><图标ID ="icon.ico" SourceFile ="Images \ Splash Screen.jpg"/>< Property Id ="ARPPRODUCTICON" Value ="icon.ico"/><!-<属性ID ="MSIUSEREALADMINDETECTION" Value ="1"/>->< WixVariable Id ="WixUIBannerBmp" Value ="Images \ Banner.bmp"/>< WixVariable Id ="WixUIDialogBmp" Value ="Images \ Background.bmp"/>< WixVariable Id ="WixUILicenseRtf" Value ="Licences \ EULA.rtf"/>< Property Id ="AllUSERS" Value ="1"/><属性ID ="WIXUI_INSTALLDIR" Value ="INSTALLFOLDER2"/>< UIRef Id ="WixUI_InstallDir"/>< MajorUpgrade DowngradeErrorMessage =已经安装了[ProductName]的较新版本."/>< MediaTemplate EmbedCab ="yes"/> 

解决方案

高权限 :安装在 %ProgramFiles%下的文件对于标准用户(以及管理员,将是只读,除非您通过 UAC提示提升权限).您必须确定您的应用程序正在执行哪些操作,要求对该文件夹下安装的文件具有写访问权限-或是否尝试向注册表中的HKLM进行写操作-这将导致相同的问题(访问被拒绝的异常).您的应用程序还可能尝试执行某些需要仅对管理员可用的 NT权限的操作.用户-导致需要提升权限(特权不同于访问权限-ACL-普遍存在于整个系统中,并且由于缺少更好的示例而没有附加"到对象上,例如更改系统时间").

移动文件 : 有几种方法可以解决此问题访问问题(或解决问题) ,但建议的问题很少.我建议您移动设置文件,该文件会导致用户配置文件出现异常,并在其中存储具有完全写访问权限的设置.您还可以将自定义ACL权限应用于已安装的文件(请参见上面链接中的第6 部分),但这并不是一个好主意,原因有很多(安全性,设置保留), 等等...).请参阅上面的链接,以获取有关替代方法的进一步说明(数据库中的存储设置以及启动时的访问权限和其他方法).


检查列表 :这是过程总结在这里.

免责声明:尽管很明显,但必须提及:切勿在实际发行版中使用调试二进制文件. 1) 完全不合法,由于透明性, 2) 并不是一个好主意和调试二进制文件的逆向工程可能性,以及 3) 调试运行时二进制文件在非开发人员的盒子上将不存在(并且不打算进行静态链接-如果那样的话)在调试模式下可用).最后:它混乱时可能很容易忘记使用发行版二进制文件进行重建像这样调试.肯定会发生.

依赖项扫描 :您可以使用许多工具来扫描可能导致启动问题的依赖项问题.这是一个依赖项扫描工具列表.也许还要检查" Visual Studio模块视图"部分.我不确定该视图是否会向您显示正在使用哪些设置文件(或仅加载了哪些二进制文件).


某些链接 :

I prepare a MSI setup project with WiX when I install this MSI package to %ProgramFiles% and make a shortcut to desktop folder it is work only run as administrator. When double click it doesn't work. When I install folder in desktop it is work with double click. I want to install to %ProgramFiles% and work with double click. Please help me I spend 2 week for this installation.

my code is here.

<Product Id="*" Name="FlowNet Master" Language="1033" Version="1.0.0.2" 
         Manufacturer="Melina-Aero" UpgradeCode="PUT-GUID-HERE">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform='x64'  />

<Icon Id="icon.ico" SourceFile="Images\Splash Screen.jpg" />
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<!--    <Property Id="MSIUSEREALADMINDETECTION" Value="1" />-->

<WixVariable Id="WixUIBannerBmp" Value="Images\Banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="Images\Background.bmp" />
<WixVariable Id="WixUILicenseRtf" Value="Licences\EULA.rtf" />
<Property Id="AllUSERS" Value="1"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER2"/>
<UIRef Id="WixUI_InstallDir"/>

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />

解决方案

Elevated Rights: Files installed under %ProgramFiles% will be read-only for standard users (and administrators as well, unless you elevate the rights via the UAC prompt). You must determine what your application is doing that requires write access to files installed under this folder - or whether you try to write to HKLM in the registry - which will cause the same problem (access denied exception). It is also possible that your application tries to do something that requires certain NT Privileges available only to admin users - causing elevation to be required (privileges differ from access rights - ACL - in being pervasive on the whole system, and not "attached" to objects - for example "change system time" - for lack of a better example).

Move Files: There are several ways to fix this access problem (or work around it), but few that are recommended. I would suggest you move the settings file that causes the exception to the user profile and store settings there with full write access. You can also apply custom ACL permissions to the installed files (see section 6 in link above), but this is not a good idea for many reasons (safety, preservation of settings, etc...). See the link above for further descriptions of alternatives (store settings in database and access on launch and other approaches).


Check List: Here is a generic check list for application launch problems.

Attach Debugger: One technique I sometimes use is to install debug-binaries to %ProgramFiles% and then show a message box immediately from the launch sequence (if the launch gets that far at all). Then I attach the Visual Studio debugger to the message box and start interactive debugging from the installed product to check for errors and exceptions. Procedure summarized here.

Disclaimer: Though obvious, it has to be mentioned: never use debug binaries for actual release. 1) Not at all legal, 2) not a good idea due to the transparency and reverse-engineering possibilities of debug binaries, and 3) debug runtime binaries will not exist on non-developer boxes (and don't be tempted to statically link - if that is possible in debug mode). And finally: it could be easy to forget to rebuild with release binaries when you mess around with debugging like this. It sure happens.

Dependency Scan: There are a number of tools you can use to scan for dependency problems that can cause launch problems. Here is a dependency scanning tools list. Maybe also check the section "Visual Studio Modules View". I am not sure if that view would show you what settings files are in use (or just what binaries are loaded).


Some Links:

这篇关于WiX安装后,我的exe文件无法通过双击运行,只能以管理员身份运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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