First, thank you for this fine piece of work. I cannot for the life of me figure out why I cannot get a SINGLE custom action in WixSharp to compile. Here a very trimmed down example of code which fails on build, but otherwise appears fine. I've sliced and diced this thing so many different ways. Always the same errors:
Severity Code Description Project File Line Suppression State Details Error (active) Invalid argument: No CA or UI entry points found in module: C:\source\repos\Solution1\WixSharpInstall\WixSharpInstall.exe WixSharpInstall C:\source\repos\Solution1\WixSharpInstall\EXEC 1
And
Severity Code Description Project File Line Suppression State Details Error (active) MSB3073 The command "cd .
set ide=true "C:\source\repos\Solution1\WixSharpInstall\bin\Debug\net472\WixSharpInstall.exe"" exited with code -532462766. WixSharpInstall C:\source\repos\Solution1\WixSharpInstall\WixSharpInstall.csproj 28
Here is the code:
using System;
using WixSharp;
using WixToolset.Dtf.WindowsInstaller;
namespace WixSharpInstall
{
internal class Program
{
static void Main()
{
var project = new Project("My Proj",
new ManagedAction(CATest, Return.check, When.After, Step.InstallFinalize, Condition.NOT_Installed)
)
{
Platform = Platform.x64,
GUID = new Guid("23ba4376-a6c1-4bec-af74-16c672702d9d"),
};
project.BuildMsi();
}
[CustomAction]
public static ActionResult CATest(Session session)
{
return ActionResult.Success;
}
}
}
The much larger version uses all kinds of other constructs including Dirs, Files, Registry Entries, Firewall Exceptions, and more. Those all work fine. I simply cannot seem to crack the mystery of the all powerful "Custom Action." What am I doing wrong here?
I found the problem by collaborating with someone on github. In Visual Studio 2022 with the latest updates, when using the project template for a new "WixSharp Setup (WiX4)" the Program class is created with "internal" scope.
To compile CustomActions the scope must be made public. Presumably, the library that handles these in a different assembly causing this problem. The normal Dirs, Files, Registry Keys, Create User, and many other functions work just fine with "internal" scope.