/// <summary> /// Builds the WiX source file (*.wxs) from the specified <see cref="Project"/> instance. /// </summary> /// <param name="path">The path to the WXS file to be build.</param> /// <param name="type">The type (<see cref="Compiler.OutputType"/>) of the setup file to be defined in the source file (MSI vs. MSM).</param> /// <returns>Path to the built WXS file.</returns> public string BuildWxs(Compiler.OutputType type = Compiler.OutputType.MSI, string path = null) { if (path == null) { return(Compiler.BuildWxs(this, type)); } else { return(Compiler.BuildWxs(this, path, type)); } }
/// <summary> /// Builds the WiX source file (*.wxs) from the specified <see cref="Project"/> instance. /// </summary> /// <param name="path">The path to the WXS file to be build.</param> /// <param name="type">The type (<see cref="Compiler.OutputType"/>) of the setup file to be defined in the source file (MSI vs. MSM).</param> /// <returns>Path to the built WXS file.</returns> public string BuildWxs(Compiler.OutputType type = Compiler.OutputType.MSI, string path = null) { if (Compiler.ClientAssembly.IsEmpty()) { Compiler.ClientAssembly = System.Reflection.Assembly.GetCallingAssembly().GetLocation(); } if (path == null) { return(Compiler.BuildWxs(this, type)); } else { return(Compiler.BuildWxs(this, path, type)); } }
public static int Main(string[] args) { string inFile = null, outFile = null; Compiler.OutputType ot = Compiler.OutputType.Exe; if (args.Length > 1) { foreach (string a in args) { if (a.ToLower().StartsWith("-ot:")) { string b = a.Substring("-ot:".Length); if (b.ToLower() == "winexe") { ot = Compiler.OutputType.WinFormsExe; } else { ot = Compiler.OutputType.Exe; } } if (a.ToLower().StartsWith("-out:")) { string b = a.Substring("-out:".Length); outFile = b; } else { inFile = a; } } if (inFile == null) { Console.WriteLine("Error: Input file not specified!"); return(1); } if (outFile == null) { outFile = Path.GetDirectoryName(inFile) + "\\" + Path.GetFileNameWithoutExtension(inFile) + ".exe"; } } else { inFile = args[0]; outFile = Path.GetDirectoryName(inFile) + "\\" + Path.GetFileNameWithoutExtension(inFile) + ".exe"; ot = Compiler.OutputType.Exe; } Console.WriteLine("Compiling '" + inFile + "'..."); // compile CompilerResults cr = Compiler.Compile(new string[] { inFile }, ot, outFile); // display errors if (cr.Errors.Count > 0) { foreach (CompilerError err in cr.Errors) { Console.WriteLine("Compile Error: " + err); } return(1); } else { Console.WriteLine("Compiled to '" + outFile + "'!"); } // return return(0); }