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);
			}
Пример #8
0
 public SharpDevelopLogger(MSBuildEngine engine)
 {
     this.worker = engine;
 }
Пример #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();
		}
Пример #10
0
			public FxCopLoggerImpl(MSBuildEngine engineWorker, IMSBuildChainedLoggerFilter nextChainElement)
			{
				this.engineWorker = engineWorker;
				this.nextChainElement = nextChainElement;
			}
Пример #11
0
			public BuildRun(Solution solution, IProject project, BuildOptions options, MSBuildEngine parentEngine)
			{
				this.solution = solution;
				this.project = project;
				this.options = options;
				this.parentEngine = parentEngine;
			}
Пример #12
0
			public SharpDevelopLogger(MSBuildEngine engine)
			{
				this.engine = engine;
			}
Пример #13
0
			public FxCopLoggerImpl(MSBuildEngine engineWorker)
			{
				this.engineWorker = engineWorker;
			}
Пример #14
0
 public EndOfChain(MSBuildEngine engine)
 {
     this.engine = engine;
 }
Пример #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);
		}
Пример #16
0
 public TaskBoundAdditionalLogger(TaskBoundAdditionalLoggerDescriptor desc, MSBuildEngine engine)
 {
     this.desc   = desc;
     this.engine = engine;
 }
Пример #17
0
 public ILogger CreateLogger(MSBuildEngine engine)
 {
     engine.InterestingTasks.Add(taskname);
     return(new TaskBoundAdditionalLogger(this, engine));
 }
Пример #18
0
 public TaskBoundLoggerFilter(TaskBoundLoggerFilterDescriptor desc, MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
 {
     this.desc       = desc;
     this.engine     = engine;
     this.nextFilter = nextFilter;
 }
Пример #19
0
		public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
		{
			return new VbcLoggerImpl(nextFilter);
		}
Пример #20
0
 public override void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink)
 {
     MSBuildEngine.StartBuild(this, options, feedbackSink, MSBuildEngine.AdditionalTargetFiles);
 }
Пример #21
0
			public EndOfChain(MSBuildEngine engine)
			{
				this.engine = engine;
			}
Пример #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);
		}
Пример #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();
		}
Пример #24
0
		public ILogger CreateLogger(MSBuildEngine engineWorker)
		{
			return new FxCopLoggerImpl(engineWorker);
		}