- using System;
- using System.Collections.Generic;
- using System.Text;
- using Microsoft.Build.BuildEngine;
-
- namespace BuildAProjectCS
- {
- class Program
- {
- static void Main(string[] args)
- {
-
- Engine engine = new Engine();
-
- engine.BinPath = @"c:\windows\microsoft.net\framework\v2.0.xxxxx";
-
- FileLogger logger = new FileLogger();
-
- logger.Parameters = @"logfile=C:\temp\build.log";
-
- engine.RegisterLogger(logger);
-
- bool success = engine.BuildProjectFile(@"c:\temp\validate.proj");
-
- engine.UnregisterAllLoggers();
- if (success)
- Console.WriteLine("Build succeeded.");
- else
- Console.WriteLine(@"Build failed. View C:\temp\build.log for details");
- }
- }
- }