I've read several other forum posts about running a C#(WIX) Custom Action from Advanced Installer and have found them helpful but only to a point. Currently I'm consuming the ***.CA.dll that is built from the Custom Action project I have in Visual Studio as an Attached Native DLL. The method stub in the DLL's source is public static ActionResult Execute(Session session) so the function I've chosen is Execute; finally I am running it immediately. This configuration has been the baseline for running a WIX Custom Action from the digging I've done.
The source for the Attached DLL consumes several other class libraries (other projects in the Visual Studio solution) as well as resource files (.sql files to be specific, also included in the project). This custom action dynamically runs SQL scripts on our DB based on conditions established in a prebuilt plugin/other class libraries. Meaning not all SQL scripts get run on every installation, only those needed for the environment it is installed into.
Below is the stack trace in the verbose logs from Advanced Installer
CustomEvolverException message:Function could not be executed.
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Deployment.WindowsInstaller.InstallerException: Function could not be executed.
at *****.CustomAction.DatabaseEvolveAction.Execute(Session session)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean skipVisibilityChecks)
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 *****.CustomAction.CA.dll returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 15:34:52: *****..CustomAction.CA.dll. Return value 3.
My Question: How do I run a custom action in Advanced Installer to execute SQL scripts using a prebuilt plugin?
Please let me know if there are any points I need to clarify.
FOLLOW US
Get the latest news in Application Packaging