How do I get WiX installer to request administrati

2019-01-13 21:50发布

We have a program we have developed in house. We are upgrading to use Visual Studio 2012, and so have to leave the Visual Studio installer project behind. InstallShield LE was giving us problems with shortcuts if the application was already installed. This left me with finally going with WiX.

I have researched this for a few days and read several posts on how to get administrator rights, but none of them seem to work. The Package element has InstallPrivileges="1" and the following Property element is present:

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

It will not request administrator privileges when it starts, and so it fails when it tries to create the program folder in C:\Program Files(x86).

3条回答
forever°为你锁心
2楼-- · 2019-01-13 22:12

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.

查看更多
Juvenile、少年°
3楼-- · 2019-01-13 22:12

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.

查看更多
时光不老,我们不散
4楼-- · 2019-01-13 22:18

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"

查看更多
登录 后发表回答