1
我们有一个自定义操作,必须在删除文件前的回滚期间执行。我们如何添加特定的自定义操作作为回滚期间的第一步执行?Wix-在回滚期间调用自定义操作
我们有下面的代码,但它不工作。
<CustomAction Id="Delete_Directory_Rollback" BinaryKey="UnifiedAgentCustomActions.dll" DllEntry="DeleteDirectory" Execute="rollback" />
<Custom Action="Delete_Directory_Rollback" Before="RemoveFiles" >NOT (REMOVE="ALL")</Custom>
自定义操作
string InstallPath = session["INSTALLDIR"];
DeleteDir(InstallPath, session);
错误消息:
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Deployment.WindowsInstaller.InstallerException: Cannot access session details from a non-immediate custom action
at Microsoft.Deployment.WindowsInstaller.Session.ValidateSessionAccess()
at Microsoft.Deployment.WindowsInstaller.Session.get_Item(String property)
at UnifiedAgentCustomActions.CustomActions.DeleteDirectory(Session session)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
CustomAction Delete_Directory_Rollback返回实际的错误代码1603而将被转换为由于继续打标成功。
预期结果
The same CA is working during uninstall but during roll back it is not working.
它不起作用?请[编辑]您的问题给我们错误消息,预期的结果,实际结果等。 – YSC
我编辑了我的文章的所有细节。 – Joe