Example #1
0
        /// <summary>
        /// Instructs the MSBuild engine to build one or more targets in the current project.
        /// </summary>
        /// <returns>true if all targets built successfully; false if any target fails</returns>
        public override bool Execute()
        {
            // Make sure the list of targets was passed in.
            if ((Targets == null) || (Targets.Length == 0))
            {
                return(true);
            }

            // This is a list of string[].  That is, each element in the list is a string[].  Each
            // string[] represents a set of target names to build.  Depending on the value
            // of the RunEachTargetSeparately parameter, we each just call the engine to run all
            // the targets together, or we call the engine separately for each target.
            List <string[]> targetLists = MSBuild.CreateTargetLists(Targets, RunEachTargetSeparately);

            var singleProject = new ITaskItem[1];

            singleProject[0] = null;
            // Build the specified targets in the current project.
            return(MSBuild.ExecuteTargets
                   (
                       singleProject, // project = null (current project)
                       null,          // propertiesTable = null
                       null,          // undefineProperties
                       targetLists,   // list of targets to build
                       false,         // stopOnFirstFailure = false
                       false,         // rebaseOutputs = false
                       BuildEngine3,
                       Log,
                       _targetOutputs,
                       UseResultsCache,
                       false,
                       null     // toolsVersion = null
                   ));
        }
Example #2
0
        public override bool Execute()
        {
            if ((this.Targets == null) || (this.Targets.Length == 0))
            {
                return(true);
            }
            ArrayList targetLists = MSBuild.CreateTargetLists(this.Targets, this.RunEachTargetSeparately);

            return(MSBuild.ExecuteTargets(new ITaskItem[] { null }, null, null, targetLists, false, false, base.BuildEngine3, base.Log, this.targetOutputs, this.UseResultsCache, false, null));
        }