我有简单的 WiX (Microsoft.Deployment.WindowsInstaller) 自定义操作:
[CustomAction]
public static ActionResult TestDtf(Session session)
{
MessageBox.Show("Test");
ActionResult result = ActionResult.Success;
return result;
}
我需要使用 InstallShield 创建的延迟/系统上下文自定义操作调用它,那么如何设置方法签名参数以便它发送会话?'Session' 基本上是 Msi 句柄吗?我曾尝试使用“MsiHandle”值,但这会导致错误:
InstallShield: Deferred action requested property MsiHiddenProperties not provided by CustomActionData
InstallShield: Loading assembly Test.Installation.CustomActions from resource 4098
InstallShield: Loading Assembly Microsoft.Deployment.WindowsInstaller
InstallShield: Unexpected parameter type Microsoft.Deployment.WindowsInstaller.Session encountered; passing string instead
InstallShield: Calling method with parameters [(System.String)294]
InstallShield: Exception: System.ArgumentException: Object of type 'System.String' cannot be converted to type 'Microsoft.Deployment.WindowsInstaller.Session'.
at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at InstallShield.ClrHelper.CustomActionHelper.CallMethod(EntryPointInfo info)