2012-09-29 5 views
0

코드를 작성하는 응용 프로그램을 만들고 있습니다. 그러나 Visual Studio 2010 속성을 프로그래밍 방식으로 설정하려고합니다.프로그래밍 방식으로 Visual Studio 2010 속성 설정

예를 들어, INCLUDE 디렉터리, 참조 디렉터리, 라이브러리 디렉터리를 VS GUI에서 설정할 모든 디렉터리로 설정하고 싶지만 프로그램 적으로이 디렉터리를 원합니다.

답변

1

이 작업을 수행하는 MSDN 문서를 볼 수 있습니다 : HTTP : //msdn.microsoft.com/en-us/library/microsoft.build.buildengine.engine.buildprojectfile는 (V = vs.90)

를 .aspx로
using System; 
using System.Collections.Generic; 
using System.Text; 
using Microsoft.Build.BuildEngine; 

namespace BuildAProjectCS 
{ 
    class Program 
    {  
     static void Main(string[] args) 
     { 
      // Instantiate a new Engine object 
      Engine engine = new Engine(); 

      // Point to the path that contains the .NET Framework 2.0 CLR and tools 
      engine.BinPath = @"c:\windows\microsoft.net\framework\v2.0.xxxxx"; 


      // Instantiate a new FileLogger to generate build log 
      FileLogger logger = new FileLogger(); 

      // Set the logfile parameter to indicate the log destination 
      logger.Parameters = @"logfile=C:\temp\build.log"; 

      // Register the logger with the engine 
      engine.RegisterLogger(logger); 

      // Build a project file 
      bool success = engine.BuildProjectFile(@"c:\temp\validate.proj"); 

      //Unregister all loggers to close the log file 
      engine.UnregisterAllLoggers(); 

      if (success) 
       Console.WriteLine("Build succeeded."); 
      else 
       Console.WriteLine(@"Build failed. View C:\temp\build.log for details"); 

     } 
    } 
} 
관련 문제