Create setup that run without admin privileges using VS 2015 Professional

穿精又带淫゛_ 提交于 2021-02-16 18:25:09

问题


I'm trying to create a setup file (MSI) that runs without admin privileges. for that, I've tried the bellow option.

  1. I've set InstallAlluser property to false as bellow.

  1. Also set InstallAllUsersVisible to false

  1. I've also changed Default location with [AppDataFolder]

After changes above properties It still required Administrator permission to execute MSI file that created using Setup project.

Can you please help me to resolve this issue.

Thanks in Advance.


回答1:


When you open your MSI with Orca (or equivalent MSI viewer), do you see the "UAC Compliant" check box checked? Sample screenshot here:

You should really use a more flexible and capable MSI tool than the Visual Studio Installer projects. They are good for a few purposes, but lack flexibility and there are numerous other problems: summary of VS Project problems (short form).

Per-User setups considered harmful: Some words of warning against per user setups. Here is one more answer on that.

A simple per-user folder installation in WiX (insert UPPERCASE GUIDs in locations shown with "PUT-GUID-HERE" (2 occurrences) - 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>


来源:https://stackoverflow.com/questions/64330448/create-setup-that-run-without-admin-privileges-using-vs-2015-professional

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