我有这个.NET应用程序,它使用Settings.settings和app.conf作为配置存储库而不是Windows注册表。在安装过程中向用户提问并将响应写入Windows注册表似乎很容易,但我还没有找到将响应写入app.config文件的方法。有谁知道怎么做?
答案 0 :(得分:0)
我做过类似的项目,要求用户在安装过程中提供所有参数。您可以创建包含所有标签和文本框和按钮的自定义表单。在安装程序类中,将该表单用作Installer类的属性。
这是一个例子
[RunInstaller(true)]
public partial class MyCustomInstaller : Installer
{
private MyCustomForm = new MyCustomForm();
// this is your custom form that allows users to modify the configuration parameters.
}
然后你可以像这样制作事件:
private void InitializeComponent()
{
this.AfterInstall += new System.Configuration.Install.InstallEventHandler(DoConfigurationManagement_AfterInstall);
}
答案 1 :(得分:0)
您可以查看this,了解如何使用CustomActions从msi安装程序更改app.config文件。