Wix 安装的应用程序(和快捷方式)显示管理符号

Wix installed app (and shortcut) shows admin symbol

成功创建和测试应用程序后,我还使用 Wix 而非 VS 提供的 ClickOnce 手动创建了此应用程序的安装程序。

无论如何,安装成功,将所有注册表项放在正确的位置,对于需要它们的文件和快捷方式也是如此(之后所有都被清理)。

这个问题并不严重,我只是很挑剔:D 在 Wix 安装程序安装的主 exe 文件上,以及指向它的快捷方式上,它们在图标右下角有蓝色和黄色的小管理盾牌。该应用程序不需要管理员权限即可正常工作,该应用程序实际上也不会以管理员身份启动 UAC 或 运行(除非通过右键单击 > 运行 以管理员身份明确完成)。

问题是如何防止屏蔽应用于应用程序和快捷方式图标?

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
    <?include "Macros.wxi" ?>

    <!-- Installation Settings -->
    <Product Id="*"
             Name="$(var.NameApp)"
             Language="1033"
             Version="1.0.0.0"
             Manufacturer="$(var.NameCompany)"
             UpgradeCode="$(var.GUID_Upgrade)">
        <Package InstallerVersion="200"
                 Compressed="yes"
                 InstallScope="perMachine"
                 Comments="Windows Installer Package"/>
        <Media Id="1"
               Cabinet="product.cab"
               EmbedCab="yes"/>
        <MajorUpgrade DowngradeErrorMessage="A newer version of this software is already installed" />

        <!-- .NET Framework Check -->
        <PropertyRef Id="NETFRAMEWORK40CLIENT" />
        <Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then try again">
            <![CDATA[Installed OR NETFRAMEWORK40CLIENT]]>
        </Condition>

        <!-- Installation files, folders, reg-keys, shortcuts, etc -->
        <Directory Id="TARGETDIR" Name="SourceDir">
            <!-- Program Files Folder -->
            <Directory Id="ProgramFilesFolder">
                <!-- Company Application Folder -->
                <Directory Id="INSTALLDIR" Name="$(var.NameCompany)">
                    <!-- Main Application Files -->
                    <Component Id="CmpAppMain" Guid="$(var.GUID_CmpAppMain)">
                        <File Id="FileAppMainEXE" Source="$(var.PathExe)" Vital="yes" />
                        <RegistryKey Root="HKLM"
                                     Key="SOFTWARE$(var.NameCompany)$(var.NameApp)">
                            <RegistryValue Name="installed"
                                           Type="integer"
                                           Value="1"
                                           KeyPath="yes" />
                        </RegistryKey>
                    </Component>

                    <!-- Common DLLs for multiple apps -->
                    <Component Id="CmpAppLibs" Guid="$(var.GUID_CmpAppLibs)">
                        <File Id="FileDeviceDLL" Source="$(var.PathLibDevice)" Vital="yes" />
                        <File Id="FileUtilDLL" Source="$(var.PathLibUtil)" Vital="yes"/>
                        <RemoveFile Id="FileClrDevice" Directory="INSTALLDIR" Name="Comms.log" On="uninstall"/>

                        <RegistryKey Root="HKLM"
                                     Key="SOFTWARE$(var.NameCompany)">
                            <RegistryValue Name="Lib Path"
                                           Type="string"
                                           Value="[INSTALLDIR]" />
                            <RegistryValue Name="Lib Ver"
                                           Type="string"
                                           Value="1.0.0"
                                           KeyPath="yes" />
                        </RegistryKey>
                    </Component>

                    <!-- Common Resource Files -->
                    <Directory Id="FolderResource" Name="rsc">
                        <Component Id="CmpAppRsc" Guid="$(var.GUID_CmpAppRscs)">
                            <File Id="RscOilDb" Source="$(var.PathRscOil)" Vital="no" KeyPath="yes"/>
                        </Component>
                    </Directory>

                </Directory>
                <!-- END - Company Application Folder -->
            </Directory>
            <!-- END - Program Files Folder -->

            <!-- Start Menu Folder -->
            <Directory Id="ProgramMenuFolder">
                <!-- Start Menu Company Folder -->
                <Directory Id="ProgramMenuCompany" Name="$(var.NameCompany)">
                    <Component Id="CmpLnks" Guid="$(var.GUID_CmpLnks)">
                        <Shortcut Id="LnkStartMenu" 
                                  Name="$(var.NameApp)"
                                  Description="$(var.NameApp)"
                                  Target="[INSTALLDIR]$(var.NameExe)"
                                  WorkingDirectory="INSTALLDIR">
                            <Icon Id="IconApp" SourceFile="$(var.PathRscIco)" />
                        </Shortcut>
                        <RegistryKey Root="HKCU"
                                     Key="SOFTWARE$(var.NameCompany)">
                            <RegistryValue Name="Lnk"
                                           Type="integer"
                                           Value="1"
                                           KeyPath="yes" />
                        </RegistryKey>
                        <RemoveFolder Id="RemoveStartLnk" Directory="ProgramMenuCompany" On="uninstall" />
                    </Component>
                </Directory>
                <!-- END - Start Menu Company Folder -->
            </Directory>
            <!-- END - Start Menu Programs Folder -->
        </Directory>
        <!-- END - TARTGETDIR -->

        <Feature Id="FeatCore" Title="Core Application Files" Level="1">
            <ComponentRef Id="CmpAppMain" />
            <ComponentRef Id="CmpAppLibs" />
            <ComponentRef Id="CmpAppRsc" />
        </Feature>
        <Feature Id="FeatLnks" Title="Start Menu Shortcut" Level="1">
            <ComponentRef Id="CmpLnks" />
        </Feature>
    </Product>
</Wix>

Does the app have a manifest at all? I'm wondering if it's got a highestavailable or asInvoker setting that means that it might sometimes elevate, and I'm assuming from what you said that it doesn't have a requiresAdministrator setting there.

A manifest is nearly always embedded in the exe itself, that's what needs verifying. I'm guessing that the exe is being built with an embedded manifest. No need to include it in the install.

感谢您提供信息。问题出在清单上,由于 ClickOnce 设置,它最初没有生成,然后一旦我为项目生成或制作了自己的清单,它也没有嵌入到可执行文件中。

ClickOnce 发布将它与它为您生成的安装程序放在安装目录中。因为我不想使用 click once(我在阅读清单后假设它会嵌入到 exe 中)我的应用程序没有清单...

我现在唯一好奇的是为什么默认行为是要求管理员权限(我认为默认情况下这是最糟糕的事情)。

无论如何...感谢您的帮助