我有一个用C#编写的CustomAction。我想在我的wix安装程序代码中调用DllEntry两次。我怎样才能做到这一点? 我是按照以下方式做到这一点的。但这对我有用。还有其他公平的方法吗?
C#代码:
[CumtomAction]
public static ActionResult SymbolicLink(Session session)
{
string s1=session.CustomActionData["value1"];
string s2=session.CustomActionData["value2"];
//mycode;
}
WixCode:
<CustomAction Id="ca" Property="dllCA" Value="value1='one';value2='two'" />
<CustomAction Id="dllCA" BinaryKey="InstallerLibrary" DllEntry="SymbolicLink" Execute="deferred"/>
<CustomAction Id="ca1" Property="dllCA1" Value="value1='three';value2='four'" />
<CustomAction Id="dllCA1" BinaryKey="InstallerLibrary" DllEntry="SymbolicLink" Execute="deferred"/>
<InstallExecuteSequence>
<Custom Action="ca" Before="InstallFinalize"></Custom>
<Custom Action="dllCA" After="ca"></Custom>
<Custom Action="ca1" Before="InstallFinalize"></Custom>
<Custom Action="dllCA1" After="ca1"></Custom>
</InstallExecuteSequence>
答案 0 :(得分:0)
定义一次应该足够了,确保在调用SymbolicLink
自定义操作之前正确设置属性:
<CustomAction Id="ca" Property="SymbolicLink" Value="value1='one';value2='two'" />
<CustomAction Id="ca1" Property="SymbolicLink" Value="value1='three';value2='four'" />
<CustomAction Id="dllCA" BinaryKey="InstallerLibrary" DllEntry="SymbolicLink" Execute="deferred"/>
<InstallExecuteSequence>
<Custom Action="ca" Before="InstallFinalize"></Custom>
<Custom Action="dllCA" After="ca"></Custom>
<Custom Action="ca1" Before="InstallFinalize"></Custom>
<Custom Action="dllCA" After="ca1"></Custom>
</InstallExecuteSequence>