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