为什么单击快捷方式后安装程序会运行? [英] Why installer runs after click on shortcut?

查看:143
本文介绍了为什么单击快捷方式后安装程序会运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用WixSharp为我的应用程序创建了一个简单的引导程序.

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");
        }
    }
}

我以管理员身份登录并安装了该应用程序(使用Installer.exe),并且在安装过程中Event Viewer中没有错误.当我单击快捷方式时,该应用程序将按预期运行.

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.

如果我以标准用户或管理员身份运行testmsi.msi,则安装时没有任何错误,并且如果单击快捷方式,应用程序将按预期运行.

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.

我以标准用户身份登录并安装了该应用程序(使用Installer.exe).在安装过程中,Event Viewer中没有错误.但是,当我单击快捷方式安装程序时,将再次运行.

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?

推荐答案

这是一项修复,它的好坏取决于重新安装的内容.应用程序事件日志应具有MsiInstaller条目,其中包含有关要修复的内容的信息.这不一定是一件坏事,需要预防.

It's a repair, which may be good or bad depending on what is being re-installed. The application event log should have MsiInstaller entries that say something about what is being repaired. It's not necessarily a bad thing that needs to be prevented.

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

Assuming you did a per-machine install, if you installed (for example) a file into the User's Application Data folder from your MSI, and then you log on as another user and run the app, then the file is obviously missing for that user. So Windows Installer will do an install for that missing part of the app. The file is probably required for all users of the system, yes? Windows assumes that if you install a file (or registry entry) into a user profile location then everyone that logs on needs this file, so it gets installed by "repair" when another user logs on and uses the shortcut.

在其他情况下,修复效果也不佳.如果您执行某些操作来删除已安装的文件,则Windows将尝试还原该文件.如果您是按用户安装,然后以其他用户身份登录,然后尝试使用该产品非预期用途的应用-每台计算机安装一次安装.

There are other scenarios where a repair is not so good. If you do something to remove a file that you installed then Windows will attempt to restore it. If you do a per-user install but then log on as another user and try to use the app that's not an intended use of the product - installer per machine to do that.

这篇关于为什么单击快捷方式后安装程序会运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆