static void Build( BE.ProjectCollection /*E.Engine*/ engine, string dir, string name, string version, string outDir) { dir = IO.Path.Combine(dir, name); Create(dir, name, version); var fileName = IO.Path.Combine(dir, name + ".csproj"); // if (!engine.BuildProjectFile(fileName)) var project = engine.LoadProject(fileName); if (!project.Build()) { throw new S.Exception("build failed"); } var path = IO.Path.Combine(dir, "bin\\Debug"); var files = IO.Directory.GetFiles(path); // copy all files. foreach (var file in files) { var outFile = IO.Path.Combine(outDir, IO.Path.GetFileName(file)); IO.File.Copy(file, outFile, true); } }
static void Main(string[] args) { // binary folder. var version = Version3 + "." + Revision(); var fileName = "linqtoxsd." + version + "-bin"; var dirName = fileName; try { IO.Directory.Delete(dirName, true); } catch (IO.DirectoryNotFoundException) { } IO.Directory.CreateDirectory(dirName); { // var engine = new E.Engine(); var engine = new BE.ProjectCollection(); { // Instantiate a new FileLogger to generate build log var logger = new E.FileLogger(); // Set the logfile parameter to indicate the log destination logger.Parameters = @"logfile=build.log"; engine.RegisterLogger(logger); } Build(engine, "..\\..\\..", XObjects, version, dirName); Build(engine, "..\\..\\..\\XObjects", XOTask, version, dirName); Build(engine, "..\\..\\..\\XObjects", Cmdline, version, dirName); engine.UnregisterAllLoggers(); } // zipping: var zipFile = fileName + ".zip"; IO.File.Delete(zipFile); { var zipProcess = new SD.ProcessStartInfo( "\"c:\\program files\\7-Zip\\7z.exe\"", "a " + zipFile + " " + dirName); zipProcess.UseShellExecute = false; var process = SD.Process.Start(zipProcess); process.WaitForExit(); } }