升级应用程序时安装到相同路径 [英] Install to same path when upgrading application

查看:18
本文介绍了升级应用程序时安装到相同路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在实施自动更新的应用程序.我有一个程序检查的 Web 服务,如果需要升级它会下载并运行新的安装程序(Visual Studio 2005 安装项目),然后程序重新启动.一切顺利.

但是我如何确保安装程序中的安装路径默认与用户最初安装程序的路径相同?

例如,如果用户将其从程序文件更改为 C:SomeFolder,我将如何让安装程序检测到并将其安装路径更改为 C:SomeFolder 而不是程序文件?或者,如果用户选择为当前用户"而不是所有用户"安装它?

解决方案

-右键单击安装项目
-查看
-注册表
- 在左侧,展开 HKey_Local_Machine 和软件,然后单击制造商节点
- 在右侧,右键单击并添加字符串注册表项
- 将注册表项命名为 InstallDir
- 设置它的值 [TARGETDIR].

安装程序后,您可以看到 InstallDir regkey 包含该位置.您的更新程序应用程序可以使用相同的路径.

通常,Just Me"和Everyone"之间的唯一区别是创建的快捷方式的位置.您可以在安装过程中运行 Process Monitor 并亲自查看.

更新程序应用程序可以通过这些步骤使用 InstallDir RegistryKey.参考:.Orca 是一个数据库表编辑器,用于创建和编辑 Windows Installer 程序包和合并模块.然后只需按照这个安装项目,固定安装工具包的位置

<小时>

另一种方法是关注 Aaron Stebner 的 如何根据注册表值修改基于 MSI 的安装程序中的默认安装路径

I have an application where I'm implementing automatic updates. I have a web service that the program checks and if it needs to upgrade it downloads and runs the new installer (Visual Studio 2005 Setup Project), after which the program relaunches. All well and good.

But how do I make sure that the installation path in the installer defaults to the same path that the user originally installed the program to?

For example, if the user changed it from program files to C:SomeFolder, how would I make the installer detect that and change it's install path to C:SomeFolder instead of program files? Or if the user chose to install it for "Current User" instead of "All Users"?

解决方案

-Right click the Setup Project
-View
-Registry
-In the left side, expand the HKey_Local_Machine and Software and click the Manufacturer node
-In the right side, right click and Add String registry key
-Name the registry key InstallDir
-Set its value [TARGETDIR].

After the program is installed you can see the InstallDir regkey contains the location. Your updater application can use this same path.

Generally the only difference between "Just Me" and "Everyone" is the location of the shortcuts that are created. You can run Process Monitor during an install and see for yourself.

EDIT:

The updater application can use the InstallDir RegistryKey with these steps. Ref: How to: Use a Registry Launch Condition to Specify a Target Directory

-Right click the Setup Project of your Updater
-View
-Launch Conditions
-Add a Search For RegistryKey
-Specify the Property as SEARCHFORINSTALLDIR
-Specify the RegKey as SOFTWAREManufacturerName
-Leave root pointing to HKLM
-Specify the Value as InstallDir

-Add a Launch Condition
-Specify the condition as SEARCHFORINSTALLDIR
-Leave InstallUrl and Message

-Right click the Setup Project
-View
-File System
-Select Application Folder
-Press F4 to view the properties of the Application Folder
-Specify the DefaultLocation as [SEARCHFORINSTALLDIR]

Now when you Build the Setup package for the Updater and run it, it will give you the value in the InstallDir regkey for the install path.

If you wish to disable the "Folder Textbox" and the "Browse" button to prevent users from changing the updaters install path you can use Orca.exe. Orca is a database table editor for creating and editing Windows Installer packages and merge modules. Then simply follow this setup project, fixing the location of installed kit


Another way you could do this is following Aaron Stebner's How to modify the default install path in an MSI-based setup based on a registry value

这篇关于升级应用程序时安装到相同路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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