project.PreserveTempFiles = true;
will prevent deleting temp file but only the ones created by Wix# not by WiX tools (e.g. *.wixpdb). The best way to solve this would be to use BuildMsiCmd:
project.UI = WUI.WixUI_InstallDir; project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); ... Process.Start(project.BuildMsiCmd()) .WaitForExit();