private void RemoveCondition(Microsoft.Build.Evaluation.Project buildProject, SolutionDataViewModel solutionData) { var allGroups = buildProject.Xml.PropertyGroups; var toRemove = new List<ProjectPropertyGroupElement>(); if (!solutionData.CreateFakes) { toRemove.AddRange(allGroups.Where(x => x.Condition.Contains("Fake"))); } if (!solutionData.CreateFakes) { toRemove.AddRange(allGroups.Where(x => x.Condition.Contains("Tests"))); } if (toRemove.Count > 0) { foreach (var pg in toRemove.Distinct()) { buildProject.Xml.RemoveChild(pg); } buildProject.Save(); } }
private void RemoveSamples(Microsoft.Build.Evaluation.Project buildProject, SolutionDataViewModel solutionData) { var items = buildProject.Items.ToArray(); var toRemove = new List<ProjectItem>(); foreach (var item in items) { var name = item.EvaluatedInclude; var index = name.IndexOf(Path.DirectorySeparatorChar); if (index < 0) { continue; } var folder = name.Substring(0, index); switch (folder) { case "Views": case "ViewModels": case "Resources": var itemName = Path.GetFileNameWithoutExtension(name); if (itemName == "ShellViewModel") { var body = CreateEmptyShell(buildProject); var itemFileName = Path.GetDirectoryName(item.Xml.IncludeLocation.File); itemFileName = Path.Combine(itemFileName, name); File.WriteAllText(itemFileName, body); continue; } toRemove.Add(item); break; } } if (toRemove.Count > 0) { buildProject.RemoveItems(toRemove); buildProject.Save(); } }
/// <summary> /// Sets build integration setting in project. /// </summary> /// <param name="project">The MSBuild project.</param> /// <param name="buildIntegration">The build integration setting.</param> internal static void SetBuildIntegrationInProject(Microsoft.Build.BuildEngine.Project project, BuildIntegration buildIntegration) { Param.AssertNotNull(project, "project"); Param.AssertNotNull(buildIntegration, "buildIntegration"); SetBuildIntegrationInProject(project, buildIntegration != BuildIntegration.None); SetTreatLevel(project, buildIntegration); project.Save(project.FullFileName); }
void Application_MailMergeAfterMerge(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Document DocResult) { DocResult.Save(); }