wixsharp setup.exe code -532462766

Nov 19, 2015 at 8:58 PM
Sometimes I get this compilation error code


What does that mean and where can find the compilation/linking error?
Nov 20, 2015 at 3:41 AM
Most likely it is the result of the exception in the user code.

This is what happens when you build WixSharp in VS:
  1. VS builds your assembly (projects executable)
  2. VS runs WixSharp.targets from the NuGet package:
<Exec Command="&quot;$(TargetPath)&quot; &quot;/MBSBUILD:$(ProjectName)&quot;" WorkingDirectory="$(ProjectDir)"/>
As the result your assembly gets executed and if it doesn't exit cleanly then VS returns a failure exit code (e.g. -532462766) assumed by VS/OS. The code itself has no meaning for the user as usually the assembly entry point routine doesn't control exit code at all:
static void Main()
However if any WiX error is encountered then it is caught by BuildMsi and printed in the VS output window. On the other hand if it is the user code raises the unhanded exception then the error info is lost. If it is the case then you can easily fix this by putting your Main implementation in the try-catch or better yet place Debugger.Launch at the start and you will be able to see the error under debugger.