internal bool Build(MSBuildEngine.ProjectToBuild ptb)
		{
			LoggingService.Debug("Run MSBuild on " + ptb.file);
			
			if (!string.IsNullOrEmpty(ptb.configuration)) {
				engine.GlobalProperties.SetProperty("Configuration", ptb.configuration);
			}
			if (!string.IsNullOrEmpty(ptb.platform)) {
				engine.GlobalProperties.SetProperty("Platform", ptb.platform);
			}
			
			Microsoft.Build.BuildEngine.Project project = buildRun.LoadProject(engine, ptb.file);
			if (project == null) {
				LoggingService.Debug("Error loading " + ptb.file);
				return false;
			}
			foreach (string additionalTargetFile in MSBuildEngine.AdditionalTargetFiles) {
				project.AddNewImport(additionalTargetFile, null);
			}
			
			bool success;
			if (string.IsNullOrEmpty(ptb.targets)) {
				success = engine.BuildProject(project);
			} else {
				success = engine.BuildProject(project, ptb.targets.Split(';'));
			}
			
			logger.FlushCurrentError();
			ReleaseOutput();
			
			LoggingService.Debug("MSBuild on " + ptb.file + " finished " + (success ? "successfully" : "with error"));
			return success;
		}
		/*
		 * Warning MSB3644: The reference assemblies for framework
		 * ".NETFramework,Version=v4.0,Profile=Client" were not found. To resolve this,
		 * install the SDK or Targeting Pack for this framework version or retarget
		 * your application to a version of the framework for which you have the SDK
		 * or Targeting Pack installed. Note that assemblies will be resolved from
		 * the Global Assembly Cache (GAC) and will be used in place of reference assemblies.
		 * Therefore your assembly may not be correctly targeted for the framework you intend.
		 */
		
		public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
		{
			if (engine.ProjectMinimumSolutionVersion >= Solution.SolutionVersionVS2010) {
				return new TargetingPackWarningWorkaroundChainEntry(nextFilter);
			} else {
				return nextFilter;
			}
		}
			public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
			{
				if (nextFilter == null)
					throw new ArgumentNullException("nextFilter");
				// ensure the engine gets notified about start/end of this task
				engine.InterestingTasks.Add(taskname);
				// Create a Filter that tracks whether the task is active.
				// If active, forward to 'baseFilter', otherwise forward to 'nextFilter'.
				return new TaskBoundLoggerFilter(this, engine, nextFilter);
			}
		internal MSBuildEngineWorker(MSBuildEngine parentEngine, MSBuildEngine.BuildRun buildRun)
		{
			this.parentEngine = parentEngine;
			this.buildRun = buildRun;
			engine = buildRun.CreateEngine();
			
			logger = new SharpDevelopLogger(this);
			engine.RegisterLogger(logger);
			foreach (IMSBuildAdditionalLogger loggerProvider in MSBuildEngine.AdditionalMSBuildLoggers) {
				engine.RegisterLogger(loggerProvider.CreateLogger(this));
			}
		}
			public TaskBoundAdditionalLogger(TaskBoundAdditionalLoggerDescriptor desc, MSBuildEngine engine)
			{
				this.desc = desc;
				this.engine = engine;
			}
			public TaskBoundLoggerFilter(TaskBoundLoggerFilterDescriptor desc, MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
			{
				this.desc = desc;
				this.engine = engine;
				this.nextFilter = nextFilter;
			}
			public ILogger CreateLogger(MSBuildEngine engine)
			{
				engine.InterestingTasks.Add(taskname);
				return new TaskBoundAdditionalLogger(this, engine);
			}
Exemplo n.º 8
0
 public SharpDevelopLogger(MSBuildEngine engine)
 {
     this.worker = engine;
 }
Exemplo n.º 9
0
		public static void StartBuild(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IEnumerable<string> additionalTargetFiles)
		{
			if (project == null)
				throw new ArgumentNullException("project");
			if (options == null)
				throw new ArgumentNullException("options");
			if (feedbackSink == null)
				throw new ArgumentNullException("feedbackSink");
			if (additionalTargetFiles == null)
				throw new ArgumentNullException("additionalTargetFiles");
			
			MSBuildEngine engine = new MSBuildEngine(project, options, feedbackSink);
			engine.additionalTargetFiles = additionalTargetFiles;
			engine.StartBuild();
		}
Exemplo n.º 10
0
			public FxCopLoggerImpl(MSBuildEngine engineWorker, IMSBuildChainedLoggerFilter nextChainElement)
			{
				this.engineWorker = engineWorker;
				this.nextChainElement = nextChainElement;
			}
Exemplo n.º 11
0
			public BuildRun(Solution solution, IProject project, BuildOptions options, MSBuildEngine parentEngine)
			{
				this.solution = solution;
				this.project = project;
				this.options = options;
				this.parentEngine = parentEngine;
			}
Exemplo n.º 12
0
			public SharpDevelopLogger(MSBuildEngine engine)
			{
				this.engine = engine;
			}
Exemplo n.º 13
0
			public FxCopLoggerImpl(MSBuildEngine engineWorker)
			{
				this.engineWorker = engineWorker;
			}
Exemplo n.º 14
0
 public EndOfChain(MSBuildEngine engine)
 {
     this.engine = engine;
 }
Exemplo n.º 15
0
		internal static void RunMSBuild(Solution solution, IProject project,
		                                string configuration, string platform, BuildOptions options)
		{
			WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront();
			MSBuildEngine engine = new MSBuildEngine();
			engine.Configuration = configuration;
			engine.Platform = platform;
			engine.MessageView = TaskService.BuildMessageViewCategory;
			engine.Run(solution, project, options);
		}
Exemplo n.º 16
0
 public TaskBoundAdditionalLogger(TaskBoundAdditionalLoggerDescriptor desc, MSBuildEngine engine)
 {
     this.desc   = desc;
     this.engine = engine;
 }
Exemplo n.º 17
0
 public ILogger CreateLogger(MSBuildEngine engine)
 {
     engine.InterestingTasks.Add(taskname);
     return(new TaskBoundAdditionalLogger(this, engine));
 }
Exemplo n.º 18
0
 public TaskBoundLoggerFilter(TaskBoundLoggerFilterDescriptor desc, MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
 {
     this.desc       = desc;
     this.engine     = engine;
     this.nextFilter = nextFilter;
 }
Exemplo n.º 19
0
		public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
		{
			return new VbcLoggerImpl(nextFilter);
		}
Exemplo n.º 20
0
 public override void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink)
 {
     MSBuildEngine.StartBuild(this, options, feedbackSink, MSBuildEngine.AdditionalTargetFiles);
 }
Exemplo n.º 21
0
			public EndOfChain(MSBuildEngine engine)
			{
				this.engine = engine;
			}
Exemplo n.º 22
0
		public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
		{
			engine.OutputTextLine(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.RunningFxCopOn} " + Path.GetFileNameWithoutExtension(engine.ProjectFileName)));
			return new FxCopLoggerImpl(engine, nextFilter);
		}
Exemplo n.º 23
0
		public static void StartBuild(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IEnumerable<string> additionalTargetFiles)
		{
			if (project == null)
				throw new ArgumentNullException("project");
			if (options == null)
				throw new ArgumentNullException("options");
			if (feedbackSink == null)
				throw new ArgumentNullException("feedbackSink");
			if (additionalTargetFiles == null)
				throw new ArgumentNullException("additionalTargetFiles");
			
			MSBuildEngine engine = new MSBuildEngine(project, options, feedbackSink);
			engine.additionalTargetFiles = additionalTargetFiles.ToList();
			if (project.MinimumSolutionVersion >= Solution.SolutionVersionVS2010) {
				engine.additionalTargetFiles.Add(Path.Combine(Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location), "SharpDevelop.TargetingPack.targets"));
			}
			engine.StartBuild();
		}
Exemplo n.º 24
0
		public ILogger CreateLogger(MSBuildEngine engineWorker)
		{
			return new FxCopLoggerImpl(engineWorker);
		}