安装程序中的Visual Studio 2010更新注册表 [英] Visual Studio 2010 update registry in setup application

查看:77
本文介绍了安装程序中的Visual Studio 2010更新注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近为我的兄弟创建了一个应用程序,该应用程序在它使用的注册表中存储了多个条目.我在VS2010中创建了一个安装应用程序,因此他可以轻松地将应用程序安装到PC上,并将条目设置为他的一些默认值(已更改).例如

I've recently created an application for my brother to use, it has several entries stored in the registry that it uses. I created a Setup Application in VS2010 so he can install the application to his PC with ease and set the entries to some default values for him, which he has changed. e.g.

我有一个名为"SummaryFolder"的条目,其值为已成功安装"(Successfully Installed)-因此,在安装时它将具有默认值.现在,他已经将其更改为PC上的实际文件夹.

I have a entry called "SummaryFolder" and the value of "Successfully Installed" - so when it was installed it would have the default value. He will have changed this by now to an actual folder on his PC.

现在,我刚刚对该程序进行了更改,并添加了两个更多的注册表项,修改了安装应用程序,并添加了新的条目以进行安装.我更改了设置应用程序的内部版本号,因此当他安装该应用程序时,它实际上会更新其现有版本.我遇到的问题是,他从初始安装中获得的现有注册表项已被默认的成功安装"值覆盖,因此删除了他设置的文件夹.

Now I've just made a change to the program and added a couple more registry entries, modified the setup application and added in the new entries for installing. I've changed the build number of the setup app, so when he installs the app, it actually UPDATES his existing version. The problem I'm having is that the existing registry entries he has from the initial installation has been overwritten with the default "Successfully Installed" values, hence removing the folder he set.

所以我的问题是:如何为安装程序指定仅在注册表项不存在的情况下添加注册表项?我想让安装程序对他来说尽可能简单.

So my question is: How can I specify for the setup program to only add the registry entries if they DON'T already exist ??? I want to have the installer to be as simple as possible for him.

非常感谢您的帮助.

推荐答案

您可以尝试以下方法:

  • 在解决方案资源管理器中选择设置项目
  • 单击解决方案资源管理器顶部的启动条件编辑器按钮
  • 添加新的注册表搜索并将其配置为搜索您的注册表项
  • 将搜索属性设置为有意义的内容,例如Summary_FOLDER_REG(仅使用大写字母,因此它是公共属性)
  • 在注册表编辑器中选择您的注册表值
  • 在其属性"窗格中,将条件"字段设置为否定的搜索属性:

  • select your setup project in Solution Explorer
  • click Launch Conditions editor button at the top of Solution Explorer
  • add a new registry search and configure it to search for your registry entry
  • set the search property to something meaningful, for example SUMMARY_FOLDER_REG (only uppercase letters so its a public property)
  • in the Registry Editor select your registry value
  • in its Properties pane set the Condition field to the negated search property:

不是summary_FOLDER_REG

NOT SUMMARY_FOLDER_REG

这样,仅当搜索找不到任何内容时,才安装注册表项.

This way the registry entry is installed only if the search doesn't find anything.

这篇关于安装程序中的Visual Studio 2010更新注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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