/// <summary> /// Adds a <Target /> element to the current project. /// </summary> /// <param name="name">The name of the target.</param> /// <param name="condition">An optional condition to add to the target.</param> /// <param name="afterTargets">A semicolon-separated list of target names. When specified, indicates that this target should run after the specified target or targets.</param> /// <param name="beforeTargets">A semicolon-separated list of target names. When specified, indicates that this target should run before the specified target or targets.</param> /// <param name="dependsOnTargets">The targets that must be executed before this target can be executed or top-level dependency analysis can occur. Multiple targets are separated by semicolons.</param> /// <param name="inputs">The files that form inputs into this target. Multiple files are separated by semicolons.</param> /// <param name="outputs">The files that form outputs into this target. Multiple files are separated by semicolons.</param> /// <param name="returns">The set of items that will be made available to tasks that invoke this target, for example, MSBuild tasks. Multiple targets are separated by semicolons.</param> /// <param name="keepDuplicateOutputs">If true, multiple references to the same item in the target's Returns are recorded. By default, this attribute is false.</param> /// <param name="label">An optional label to add to the target.</param> /// <returns>The current <see cref="ProjectCreator"/>.</returns> public ProjectCreator Target( string name, string condition = null, string afterTargets = null, string beforeTargets = null, string dependsOnTargets = null, string inputs = null, string outputs = null, string returns = null, bool?keepDuplicateOutputs = null, string label = null) { _lastTarget = AddTopLevelElement(RootElement.CreateTargetElement(name)); _lastTarget.AfterTargets = afterTargets ?? string.Empty; _lastTarget.BeforeTargets = beforeTargets ?? string.Empty; _lastTarget.Condition = condition; _lastTarget.DependsOnTargets = dependsOnTargets ?? string.Empty; _lastTarget.Inputs = inputs ?? string.Empty; _lastTarget.Outputs = outputs ?? string.Empty; _lastTarget.Returns = returns; _lastTarget.Label = label; if (keepDuplicateOutputs != null) { _lastTarget.KeepDuplicateOutputs = keepDuplicateOutputs.ToString(); } return(this); }