internal async Task <TestProject> CreateCloneAsync(AppleTestTask test) { var rv = Clone(); await rv.CreateCopyAsync(test); return(rv); }
internal async Task CreateCopyAsync(AppleTestTask test = null) { var directory = DirectoryUtilities.CreateTemporaryDirectory(test?.TestName ?? System.IO.Path.GetFileNameWithoutExtension(Path)); Directory.CreateDirectory(directory); var original_path = Path; Path = System.IO.Path.Combine(directory, System.IO.Path.GetFileName(Path)); await Task.Yield(); XmlDocument doc; doc = new XmlDocument(); doc.LoadWithoutNetworkAccess(original_path); var original_name = System.IO.Path.GetFileName(original_path); if (original_name.Contains("GuiUnit_NET") || original_name.Contains("GuiUnit_xammac_mobile")) { // The GuiUnit project files writes stuff outside their project directory using relative paths, // but override that so that we don't end up with multiple cloned projects writing stuff to // the same location. doc.SetOutputPath("bin\\$(Configuration)"); doc.SetNode("DocumentationFile", "bin\\$(Configuration)\\nunitlite.xml"); } doc.ResolveAllPaths(original_path); var projectReferences = new List <TestProject> (); foreach (var pr in doc.GetProjectReferences()) { var tp = new TestProject(pr.Replace('\\', '/')); await tp.CreateCopyAsync(test); doc.SetProjectReferenceInclude(pr, tp.Path.Replace('/', '\\')); projectReferences.Add(tp); } this.ProjectReferences = projectReferences; doc.Save(Path); }