winforms - 使用 VS 2015 Professional 创建无需管理员权限即可运行的设置

标签 winforms installation visual-studio-2015 windows-installer setup-project

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

  • 我已经设置了安装所有用户 属性(property)到如下。

  • enter image description here
  • 还设置了 安装所有用户可见

  • enter image description here
  • 我还使用 更改了默认位置[AppDataFolder]

  • enter image description here
    更改上述属性后,仍需要管理员权限才能执行使用安装项目创建的 MSI 文件。
    你能帮我解决这个问题吗?
    提前致谢。

    最佳答案

    当您使用 Orca ( or equivalent MSI viewer ) 打开您的 MSI 时,您是否看到了 "UAC Compliant" 复选框被选中?示例截图在这里:
    UAC Checkbox
    你真的应该使用 a more flexible and capable MSI tool比 Visual Studio 安装程序项目。它们有一些用途,但缺乏灵活性,还有许多其他问题: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.


    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>
    

    关于winforms - 使用 VS 2015 Professional 创建无需管理员权限即可运行的设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64330448/

    相关文章:

    .net - 如何设置 GroupBox 标题颜色

    c# - ActiveX 控件在 IE 以外的单独窗口中运行

    windows - 如何在 Windows 上手动配置和启动 PostgreSQL?

    c++ - 将第三方库与程序可执行文件分开

    c# - 如何给DataGridView 的行编号?

    c# - 从 xml 文件加载控件

    c++ - CMake:使用项目安装 boost 组件库的正确方法

    installation - 需要安装 JRE 方面的帮助吗?

    c++ - 如果未使用的函数参数是指向函数的指针,是否需要为其实际参数定义?

    c++ - 使用 ZeroMemory 初始化数组