简体   繁体   English

安装后如何执行Wix自定义操作?

[英]How to execute Wix custom action after installation?

I am using Wix3 to install WCF service to IIS. 我正在使用Wix3将WCF服务安装到IIS。

How can I use my custom action (c#) function after installation completed? 安装完成后如何使用自定义操作(c#)函数? ie I need to open installed web.config file and replace hostname with real one. 即我需要打开安装的web.config文件,并用真实的主机名替换主机名。

Any ideas? 有任何想法吗?

您可以在InstallExecuteSequence中的 InstallFinalize操作之后安排它。

There is a sequence of Actions in Windows Installer. Windows Installer中有一系列操作。 The WiX tutorial has a good section on events (and is a great resource anyway). WiX教程很好地介绍了事件(无论如何都是很好的资源)。

A typical example of getting something to run after InstallFinalize is to get the installed app to start. 在InstallFinalize之后运行某些程序的典型示例是启动已安装的应用程序。

<InstallExecuteSequence>
   <Custom Action='LaunchFile' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>

Why would you: 你为什么要:

1) Need a custom action? 1)需要自定义动作? 2) Do it after the install instead of during the install? 2)是在安装之后而不是安装期间执行吗?

WiX has a built-in extension for handling what you are trying to do: WiX具有内置扩展名,可以处理您要执行的操作:

XmlFile Element (Util Extension) XmlFile元素(实用程序扩展)

It will update your XML after the file has been installed and handle rollback scenarios as well. 安装文件后,它将更新您的XML,并处理回滚方案。

What you will have to write a CA for though is reading the XML value back into a property ti handle repair and upgrade situations. 不过,您必须编写CA的原因是将XML值读回到属性中,以便处理修复和升级情况。 Read: 读:

The WiX toolset's "Remember Property" pattern . WiX工具集的“记住属性”模式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM