Using Easy Code Signing with WixSharp
You can use the program in your setup script. You do this after you build the MSI. These examples are directly from my comic book millennium setup. So you might need to modify them some.
So in your script would put this:
string msiproject = buildmsi();
ExternalTool et = new ExternalTool();
et.ExePath = "ecs.exe";
et.Arguments = "\"/p:" + productname + ".msi";
And if you are using a bootstrapper, you might be having issues after signing your msi and it refusing to run. That's because there is an application inside the bootstrapper exe that isn't signed. Why the Wix people would do that is weird. But you need to extract the file and sign it. You do that with this code:
ExternalTool ig = new ExternalTool();
ig.WellKnownLocations = @"C:\Program Files (x86)\WiX Toolset v3.11\bin";
ig.ExePath = "insignia.exe";
ig.Arguments = "-ib \"" + productname + "netfx.exe\" -o engine.exe";
et.Arguments = "\"/p:engine.exe";
ig.Arguments = " -ab engine.exe \"" + productname + "netfx.exe\" -o \"" + productname + "netfx.exe\"";
You'll need to update the portion of the script to match your location of course. Like you might decide you don't want to have the netfx.exe as the end of the file name. Or your location for the wix files might be different.
Another thing that might be different from your script and mine, you might not have the first external tool declaration in the same area. So you would need to declare et again in the bootstrapper portion and assign the ExePath.