使用VS 2015 Professional创建无需管理员特权即可运行的安装程序

问题描述

我正在尝试创建一个无需管理员特权即可运行的安装文件(MSI)。为此,我尝试了波纹管选项。

  1. 我已经将 InstallAlluser 属性设置为 false

enter image description here

  1. 还将 InstallAllUsersVisible 设置为 false

enter image description here

  1. 我还使用 [AppDataFolder]
  2. 更改了认位置

enter image description here

更改以上属性后,仍然需要管理员权限才能执行使用安装程序项目创建的MSI文件

能帮我解决这个问题吗?

预先感谢。

解决方法

当您使用Orca(or equivalent MSI viewer)打开MSI时,是否看到选中了 "UAC Compliant" 复选框?此处的示例屏幕截图:

UAC Checkbox

您应该真正使用a more flexible and capable MSI tool而不是Visual Studio Installer项目。它们有几个用途,但缺乏灵活性,还有许多其他问题:summary of VS Project problemsshort form)。

每个用户的设置被认为是有害的:Some words of warning against per user setups。这是one more answer on that

在WiX中进行简单的按用户文件夹安装(在显示为“ PUT-GUID-HERE”的位置插入大写GUID (2次出现-you can use this GUID generator):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="PerUserSample" Language="1033" Version="1.0.0.0" Manufacturer="-" UpgradeCode="PUT-GUID-HERE">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="limited" />

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

    <Feature Id="ProductFeature" Title="PerUserSample" Level="1" />

    <Directory Id="TARGETDIR" Name="SourceDir">

      <Directory Id="AppDataFolder">
        <Directory Id="Something" Name="Something">
          <Component Feature="ProductFeature" Guid="PUT-GUID-HERE">

            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\Test"
                           Name="installed" Type="integer" Value="1" KeyPath="yes"/>

            <File Source="C:\Windows\Notepad.exe" />

            <RemoveFolder Id="Something" Directory="Something" On="uninstall" />

          </Component>
        </Directory>
      </Directory>
      
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="PerUserSample" />
      </Directory>

    </Directory>

  </Product>

</Wix>