首页 > 解决方案 > Why installer runs after click on shortcut?

问题描述

I created a simple bootstrapper for my application using WixSharp.

namespace TestBootstrapper
{
    class Program
    {
        static void Main()
        {
            var package = new MsiPackage("../testmsi.msi")
            {
                DisplayInternalUI = true,
                Id = "MyId",
                Compressed = true,
                Visible = true
            };

            var bootstrapper = new Bundle("MyTestInstaller", package)
            {
                Version = new Version("1.0.0.0"),
                UpgradeCode = new Guid("1FCC927B-7BB0-4FB0-B81E-2D87012E470B"),
                PreserveTempFiles = true,
                DisableModify = "yes",
                DisableRemove = true
            };

            bootstrapper.Build("Installer.exe");
        }
    }
}

I logged as admin and installed the application (using Installer.exe) and there were no errors in Event Viewer during installation. When I clicked shortcut the application runs as expected.

If I run testmsi.msi as standard user or admin it installed without any errors and if I clicked shortcut the application runs as expected.

I logged as standard user and installed the application (using Installer.exe). There were no errors in Event Viewer during installation. But when I clicked shortcut installer runs again.

So, why installer runs and how to prevent this behavior?

标签: wixwindows-installerinstallationbootstrapperwixsharp

解决方案


这是一种修复,取决于重新安装的内容,这可能是好是坏。应用程序事件日志应该有 MsiInstaller 条目,说明正在修复的内容。这不一定是需要预防的坏事。

假设您进行了每台机器的安装,如果您从 MSI 将一个文件(例如)安装到用户的应用程序数据文件夹中,然后您以另一个用户身份登录并运行该应用程序,那么该用户显然缺少该文件. 因此,Windows Installer 将为应用程序的缺失部分进行安装。系统的所有用户可能都需要该文件,是吗?Windows 假定如果您将文件(或注册表项)安装到用户配置文件位置,那么登录的每个人都需要此文件,因此当另一个用户登录并使用快捷方式时,它会通过“修复”安装。

在其他情况下,修复效果不佳。如果您采取措施删除已安装的文件,Windows 将尝试恢复它。如果您执行按用户安装,但随后以其他用户身份登录并尝试使用不是产品预期用途的应用程序 - 每台机器的安装程序执行此操作。


推荐阅读