How do I get WiX installer to request administrative privileges?

a 夏天 提交于 2019-11-27 19:25:12
Atrotygma

Answer on How to get WiX installer to request Administrative Privileges

Solution found by Opus Krokus in comment.

Answer

I added the following (to the Package element), and I am not sure which (or what combination) gave me what I need, but it works now: InstallPrivileges="elevated" AdminImage="yes" InstallScope="perMachine"

Andreas

Look at the answer to this Stack Overflow question.

Here is the essence of the answer:

<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

The solution suggested by Opus Krokus did not work for me.

This is what worked for me, for my MSI created for installation on Windows 7 (and later versions):

  <!-- Set per-machine installation as default.
  See See http://msdn.microsoft.com/en-us/library/dd408007.aspx for an explanation of ALLUSERS=2 and MSIINSTALLPERUSER="".
  -->
  <Property Id="ALLUSERS" Value="2" />
  <!-- Needs to be empty value (and empty value must be commented out to get rid of error message when compiling):
  <Property Id="MSIINSTALLPERUSER" Value="" /> 
  -->

As mentioned in the above XML-comment, see http://msdn.microsoft.com/en-us/library/dd408007.aspx for details.

You need 2 commands:

<Property Id="MSIUSEREALADMINDETECTION" Value="1" />     

<Condition Message="Installation requires Administrator privileges">
    <![CDATA[Privileged]]>
</Condition>

Observe that you must surround Privileged with <![CDATA[ and ]]>.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!