Microsoft.Build.BuildEngine.Target.Build C# (CSharp) Method

Build() private method

private Build ( string built_targets_key, bool &executeOnErrors ) : bool
built_targets_key string
executeOnErrors bool
return bool
		bool Build (string built_targets_key, out bool executeOnErrors)
		{
			bool result = false;
			executeOnErrors = false;

			// built targets are keyed by the particular set of global
			// properties. So, a different set could allow a target
			// to run again
			built_targets_key = project.GetKeyForTarget (Name);
			if (project.ParentEngine.BuiltTargetsOutputByName.ContainsKey (built_targets_key)) {
				LogTargetSkipped ();
				return true;
			}

			// Push a null/empty batch, effectively clearing it
			project.PushBatch (null, null);
			if (!ConditionParser.ParseAndEvaluate (Condition, Project)) {
				LogMessage (MessageImportance.Low,
						"Target {0} skipped due to false condition: {1}",
						Name, Condition);
				project.PopBatch ();
				return true;
			}

			try {
				buildState = BuildState.Started;
				result = BuildDependencies (GetDependencies (), out executeOnErrors);

				if (!result && executeOnErrors)
					ExecuteOnErrors ();

				if (result)
					// deps built fine, do main build
					result = DoBuild (out executeOnErrors);

				buildState = BuildState.Finished;
			} catch (Exception e) {
				LogError ("Error building target {0}: {1}", Name, e.ToString ());
				return false;
			} finally {
				project.PopBatch ();
			}

			project.ParentEngine.BuiltTargetsOutputByName [built_targets_key] = (ITaskItem[]) Outputs.Clone ();

			return result;
		}

Same methods

Target::Build ( ) : bool
Target::Build ( string built_targets_key ) : bool