在安装过程中初始化user.config或app.exe.config [英] Initializing user.config or app.exe.config during install

查看:211
本文介绍了在安装过程中初始化user.config或app.exe.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个.NET的WinForms应用程序,它依赖于user.config存储各种有用的设置,如内网Web服务的URL。我们想使人们有可能为安装的一部分导入自定义初始设置。该用例是,如果一个公司有他们想要安装的软件100台机器,并且他们都应该有一个参考,以有问题的内部网的网络服务,这不应该需要手动在所有计算机上设置。

I am developing a .NET WinForms application which relies on user.config to store various useful settings such as intranet web service URLs. We would like to make it possible to import custom initial settings as part of the installation. The use case for this is if a company has 100 machines they want to install the software on, and they should all have a reference to the intranet web service in question, this should not need to be set up manually on all the machines.

目前,我们正在使用VS2008安装项目生成安装包。

We are currently using a VS2008 setup project to generate the install package.

我们的想法迄今已使安装程序来进行的信息(从模板)的自定义初始config文件,然后把在地方,而不是默认的安装项目将安装。

Our idea so far has been to enable the installer to make a custom initial .config file with the information (from a template), and then put that in place instead of the default one that the setup project installs.

不过,我看不到一个办法做到这一点除了这几个:

However, I can't see a way to do this other than these few:

  1. 在硬$ C C的可执行文件名到自定义安装程序操作(从System.Configuration.Install.Installer派生),才能使用ConfigurationManager中类,以确定config文件路径$。这将需要手动更改安装程序,如果可执行文件名更改。
  2. 滚动自己的配置类或文件/文件夹层次结构保存设置。这基本上是从隔离机制的优势(这也是障碍在这里).NET提供,如果我理解正确禁止我们。

有谁知道任何替代品,或方式,使上述两个可口?

Does anyone know of any alternatives, or of ways to make the above two palatable?

我恐怕答案可能是不这样做,这违背了该机制的精神,推出自己的设置导入机制。

I fear the answer may be "don't do this, it defeats the spirit of the mechanism, roll your own settings import mechanism".

推荐答案

我想这就是你需要:的http://raquila.com/software/configure-app-config-application-settings-during-msi-install/

这篇关于在安装过程中初始化user.config或app.exe.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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