如何基于使用WixSharp创建的MSI中的用户输入生成文件?

时间:2019-07-19 08:24:44

标签: wixsharp

我使用 WixSharp 创建了一个安装 MSI 软件包。我有一个自定义对话框,其中包含语言,服务器等选项。我想基于这些选项生成一个应用程序配置文件,并将其部署在.exe文件旁边,作为安装过程的一部分。如果有可能,我该怎么办?

1 个答案:

答案 0 :(得分:0)

您可以订阅AfterInstall事件(已复制文件时)并在那里修改配置文件。

AfterInstall demostration

  

project.AfterInstall + = project_AfterInstall;

     

...

     

静态无效project_AfterInstall(SetupEventArgs e)

安装目录,您可以在这里找到:

private void OnAfterInstall(SetupEventArgs e)
{
    var installationPath = e.Session["INSTALLDIR"];

    // Change your config file here
    // if you need to modify your file once time after installation
    // just add this one condition if (e.IsInstalled) { ... }
}