public void ResetBuildVirtualPropertyReset() { Project p = new Project(new Engine()); p.LoadXml(TestData.ContentCreatePropertyTarget); p.SetProperty("p", "v1"); p.Build("CreatePropertyTarget"); Assertion.AssertEquals("v", p.GetEvaluatedProperty("p")); p.ResetBuildStatus(); Assertion.AssertEquals("v1", p.GetEvaluatedProperty("p")); }
/// <summary> /// Engine.BuildProject gets called recursively when projects use the /// MSBuild *task* to build other child projects. If "numberOfProjectsInProgress" /// is 0, then we know we are currently NOT in a recursive call. We /// are really being called at the top level. /// </summary> private void StartRootProjectBuild(BuildRequest buildRequest, Project project) { foreach (Project loadedProject in projectsLoadedByHost.Values) { // There should be no projects in the ProjectManager with the same full path, global properties and tools version // as any of the loaded projects. If there are, something went badly awry, because // we were supposed to have deleted them after the last build. ErrorUtilities.VerifyThrow(null == this.cacheOfBuildingProjects.GetProject(loadedProject.FullFileName, loadedProject.GlobalProperties, loadedProject.ToolsVersion), "Project shouldn't be in ProjectManager already."); // Add the loaded project to the list of projects being built, just // so that during the build, we have only one place we need to look // instead of having to search multiple lists. this.cacheOfBuildingProjects.AddProject(loadedProject); } if (0 == (buildRequest.BuildSettings & BuildSettings.DoNotResetPreviouslyBuiltTargets)) { // Reset the build state for all projects that are still cached from the // last build and the currently loaded projects that we just added to // the ProjectManager. this.cacheOfBuildingProjects.ResetBuildStatusForAllProjects(); // Clear the project build results cache this.cacheManager.ClearCache(); // Reset the build state for the project that we're going to build. This may not // be in the ProjectManager if it doesn't have a FullFileName property. project.ResetBuildStatus(); } }
public void ResetBuildVirtualItemReset() { Project p = new Project(new Engine()); p.LoadXml(TestData.ContentCreateItemTarget); p.AddNewItem("BuildItem", "i1"); p.Build("CreateItemTarget"); Assertion.AssertEquals("i1", p.EvaluatedItems[0].Include); Assertion.AssertEquals("i", p.EvaluatedItems[1].Include); int preCount = p.EvaluatedItems.Count; p.ResetBuildStatus(); Assertion.AssertEquals("i1", p.EvaluatedItems[0].Include); Assertion.AssertEquals(preCount - 1, p.EvaluatedItems.Count); }