1

wxs file


<Dialog Id="InputParameters" Width="370" Height="270" Title="!(ll.MyDlg_Title)">
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
          <Publish Event="DoAction" Value="ValidateParameters" >1</Publish>   
        </Control>
 <Dialogue>

<CustomAction Id="ValidateParameters" BinaryKey="my_dll.CA.dll" DllEntry="ValidateParametersFunc" Execute="immediate" />     

CustomAction.cs file

[CustomAction]
public static ActionResult ValidateParametersFunc(Session session) 
{
     session.log("perform validation");
     return ActionResult.Success;
} 

CustomAction.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" />
        <supportedRuntime version="v2.0.50727"/>
<configuration>

I am trying to execute a validation function when user clicks on Next Button on InputParameters Dialogue. My all other custom actions work find which are included in InstallExecuteSequence. If I use a VBScript to display a popup using following customAction instead of above function ValidateParametersFunc then that works fine.

   <CustomAction Id="ValidateEnrollmentParameters" Script="vbscript" Execute="immediate"> <!CDATA[msgbox "You clicked?"]]></CustomAction>

But I want to execute the function ValidateParametersFunc. I am getting error:


Action 18:58:13: ValidateParametersFunc. 
Action start 18:58:13: ValidateParametersFunc.
MSI (c) (C4:20) [18:58:13:233]: Invoking remote custom action. DLL: C:\Users\MyUser\AppData\Local\Temp\2\MSI8187.tmp, Entrypoint: ValidateParametersFunc
MSI (c) (C4:A4) [18:58:13:236]: Cloaking enabled.
MSI (c) (C4:A4) [18:58:13:236]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (C4:A4) [18:58:13:236]: Connected to service for CA interface.
Action ended 18:58:13: ValidateEnrollmentParameters. Return value 3.
MSI (c) (C4:04) [18:58:13:807]: Note: 1: 2205 2:  3: Error 
MSI (c) (C4:04) [18:58:13:807]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2896 
DEBUG: Error 2896:  Executing action ValidateParametersFunc failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: ValidateParametersFunc, , 

Target framework for CustomActions project is : v4.6.1 Can someone please help? I have tried everything given on the internet but still not able to figure out how to fix this.

Tina
  • 15
  • 3
  • A bit busy right now, but please check if this project helps: https://github.com/glytzhkof/WiXOpenLogFile and [have a read here](https://stackoverflow.com/a/60850388/129130) and follow the links please. There are further WiX examples at the top level of that Github repository. – Stein Åsmul Oct 14 '21 at 07:57

0 Answers0