Reputation: 838
I have an installer which has a custom screen containing a button. When that button is pressed, a Custom Action must run which verifies a few things, and returns success or an error.
I have my button defined as follows:
<Control Type="PushButton" Id="DatabaseVerifyConnectionButton" X="118" Y="150" Width="116" Height="17" Text="Verify Connection" Property="DATABASEVERIFYCONNECTIONBUTTONPROPERTY" Default="yes">
<Publish Event="DoAction" Value="VerifyDatabaseConnection">1</Publish>
<Publish Event="SpawnDialog" Value="VerifySuccessDlg">VERIFIEDCONNECTION = "1"</Publish>
<Publish Event="SpawnDialog" Value="VerifyFailedDlg">VERIFIEDCONNECTION = "0"</Publish>
</Control>
My Custom Action XML
<CustomAction Id="VerifyDatabaseConnectionCA"
BinaryKey="DatabaseCustomAction.CA.dll"
DllEntry="VerifyDatabaseConnection2"
Execute="immediate"
Return="check"/>
<CustomAction Id='VerifyDatabaseConnection'
Property='VerifyDatabaseConnectionCA'
Execute='immediate'
Value="ServerIP=[DATABASESERVERIPTEXTBOXPROPERTY];Username=[DATABASEUSERNAMETEXTBOXPROPERTY];Password=[DATABASEPASSWORDTEXTBOXPROPERTY]"/>
My Custom Action C# code:
[CustomAction]
public static ActionResult VerifyDatabaseConnection(Session session)
{
System.Diagnostics.Process.Start(@"C:\Windows\System32\calc.exe");
return ActionResult.Failure;
}
The logs show the following:
MSI (c) (58:B4) [16:39:45:183]: Doing action: VerifyDatabaseConnection
Action 16:39:45: VerifyDatabaseConnection.
Action start 16:39:45: VerifyDatabaseConnection.
Action ended 16:39:45: VerifyDatabaseConnection. Return value 1.
I have tried a lot of things. Attaching a debugger, doesn't work. Returning success or failure, doesn't seem to matter anything. Heck, it doesn't even start up the calculator when you click the button. I did notice that changing the entry point for the custom action didn't seem to matter at all.
I also read something about MakeSfxCA.exe, but I couldn't for the life of me find ANYWHERE on how to make it work properly. But I also read that Visual Studio should do it for you if you added the Custom Action project as a Custom Action Project, which I did.
I'm at a complete loss here. Why won't this work? It shows success everywhere but it just does not execute any code at all.
Upvotes: 6
Views: 1746
Reputation: 10080
<CustomAction Id="VerifyDatabaseConnectionCA"
BinaryKey="DatabaseCustomAction.CA.dll"
DllEntry="VerifyDatabaseConnection2"
Execute="immediate"
Return="check"/>
Check you DLLEntry name "VerifyDatabaseConnection2" but you actual custom action method name is "VerifyDatabaseConnection" (2 is missing, so that was never getting called").
Also change the publish element to call "VerifyDatabaseConnectionCA" instead of "VerifyDatabaseConnection".
Upvotes: 1