Beispiel #1
0
        public static void TargetCleanOutput(ITaskContext context)
        {
            string buildConfiguration = context.Properties.Get <string>(BuildProps.BuildConfiguration);
            string productRootDir     = context.Properties.Get(BuildProps.ProductRootDir, ".");

            VSSolution solution = context.Properties.Get <VSSolution>(BuildProps.Solution);

            solution.ForEachProject(
                delegate(VSProjectInfo projectInfo)
            {
                if (projectInfo is VSProjectWithFileInfo)
                {
                    VSProjectWithFileInfo info = (VSProjectWithFileInfo)projectInfo;

                    LocalPath projectOutputPath = info.GetProjectOutputPath(buildConfiguration);

                    if (projectOutputPath == null)
                    {
                        return;
                    }

                    FullPath projectFullOutputPath = info.ProjectDirectoryPath.CombineWith(projectOutputPath);
                    DeleteDirectoryTask.Execute(context, projectFullOutputPath.ToString(), false);

                    string projectObjPath = String.Format(
                        CultureInfo.InvariantCulture,
                        @"{0}\obj\{1}",
                        projectInfo.ProjectName,
                        buildConfiguration);
                    projectObjPath = Path.Combine(productRootDir, projectObjPath);
                    DeleteDirectoryTask.Execute(context, projectObjPath, false);
                }
            });
        }
Beispiel #2
0
 public TRunner DeleteDirectory(string directoryPath, bool failIfNotExists)
 {
     DeleteDirectoryTask.Execute(scriptExecutionEnvironment, directoryPath, failIfNotExists);
     return(ReturnThisTRunner());
 }