1

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?

2
  • You failed to mention the version that you're using. Did you try the example on the Github page? Commented Sep 2, 2024 at 4:08
  • Yeah, I think I got it sorted out. I created an issue on the github site here: github.com/oleg-shilo/wixsharp/issues/1624 As far as I can tell, it looks like the samples are not maintained as improvements are made to the project. The issue is the "internal" scope classifier on the Program class. They say the template doesn't do that, but something is making it not public. Custom Actions must be accessed from a different assembly requiring Program to be public. Commented Sep 2, 2024 at 14:19

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.