public void Transform(IRename rename, ISolutionCommand solutionCommand) { solutionCommand.Process(solutionFile); var renameCommand = new TransformCommand(new DontFilter(), new NameTransform(rename)); renameCommand.Process(solutionFile); foreach (var project in solutionFile.Projects.Where(p => !p.IsFolder)) { project.Name = rename.RenameSolutionProjectName(project.Name); project.Path = new FilePath (rename.RenameCsproj(project.Path.Path), false); project.XmlFile.Document.Save(rename.RenameCsproj(project.XmlFile.Path.Path)); // Note that project.Path and project.XmlFile.Path have different values.... } solutionFile.Save(rename.RenameSln(solutionFile.FullPath.Path)); }
public void Transform(IRename rename, ISolutionCommand solutionCommand) { solutionCommand.Process(solutionFile); var renameCommand = new TransformCommand(new DontFilter(), new NameTransform(rename)); renameCommand.Process(solutionFile); foreach (var project in solutionFile.Projects.Where(p => !p.IsFolder)) { project.Name = rename.RenameSolutionProjectName(project.Name); project.Path = new FilePath(rename.RenameCsproj(project.Path.Path), false); project.XmlFile.Document.Save(rename.RenameCsproj(project.XmlFile.Path.Path)); // Note that project.Path and project.XmlFile.Path have different values.... } solutionFile.Save(rename.RenameSln(solutionFile.FullPath.Path)); }
private void SaveProjectsAndSolution(IRename rename) { foreach (var project in solutionFile.Projects.Where(p => !p.IsFolder)) { project.Name = rename.RenameSolutionProjectName(project.Name); project.Path = new FilePath (rename.RenameCsproj(project.Path.Path), false); // Note that project.Path and project.XmlFile.Path have different values.... var from = project.XmlFile.Path.Path; var to = rename.RenameCsproj(from); project.XmlFile.Save(to); Duplicate(from, to, ".cspscc"); Duplicate(from, to, ".user"); } var destination = rename.RenameSln(solutionFile.FullPath.Path); var filePath = new FilePath(destination, false, true); solutionFile.Save(filePath); }
public void ProcessProjects(IRename rename, ITransform transform) { var nameTransform = new NameTransform(rename); var fullTransform = new CompositeTransform(transform, nameTransform); string basePath = Path.GetDirectoryName(path); foreach (var project in projects.Where(p => !p.IsFolder)) { var projectPath = Path.Combine(basePath, project.Path); var document = new XmlDocument(); document.Load(projectPath); fullTransform.ApplyTransform(projectPath, document); project.Name = rename.RenameSolutionProjectName(project.Name); project.Path = rename.RenameCsproj(project.Path); document.Save(rename.RenameCsproj(projectPath)); // Note that projectPath and project.Path have different values.... } Save(rename.RenameSln(path)); }
public override void DoApplyTransform(XmlDocument document) { foreach (XmlElement element in document.SelectNodes("//x:ProjectReference", namespaces)) { element.SetAttribute("Include", nameReplace.RenameCsproj(element.GetAttribute("Include"))); } foreach (XmlElement element in document.SelectNodes("//x:ProjectReference/x:Name", namespaces)) { element.InnerText = nameReplace.RenameProjectName(element.InnerText); } }