/// <summary> /// Creates the specified path. /// </summary> /// <param name="path">The path.</param> /// <param name="references">The references.</param> public static void Create(string path, params string[] references) { var solutionPath = System.IO.Path.Combine(path, @"test.sln"); var projectPath = System.IO.Path.Combine(path, "InnerTest.csproj"); var solution = new Solution(new ProjectChangeWatcher(solutionPath)); var project = new CSharpProject(new ProjectCreateInformation { Solution = solution, SolutionName = solution.Name, ProjectName = "InnerTest", OutputProjectFileName = projectPath }); var provider = (IProjectItemListProvider)project; foreach (var reference in references) { provider.AddProjectItem(new ReferenceProjectItem(project, reference)); } solution.AddFolder(project); ParserService.CreateProjectContentForAddedProject(project); solution.FixSolutionConfiguration(new IProject[] { project }); ProjectService.OpenSolution = solution; ProjectService.CurrentProject = project; }
public static void AddProject(ISolutionFolderNode solutionFolderNode, IProject newProject) { solutionFolderNode.Container.AddFolder(newProject); ParserService.CreateProjectContentForAddedProject(newProject); solutionFolderNode.Solution.FixSolutionConfiguration(new IProject[] { newProject }); OnProjectAdded(new ProjectEventArgs(newProject)); }
public static void AddProject(ISolutionFolderNode solutionFolderNode, IProject newProject) { if (solutionFolderNode.Solution.SolutionFolders.Any( folder => string.Equals(folder.IdGuid, newProject.IdGuid, StringComparison.OrdinalIgnoreCase))) { LoggingService.Warn("ProjectService.AddProject: Duplicate IdGuid detected"); newProject.IdGuid = Guid.NewGuid().ToString().ToUpperInvariant(); } solutionFolderNode.Container.AddFolder(newProject); ParserService.CreateProjectContentForAddedProject(newProject); OnProjectAdded(new ProjectEventArgs(newProject)); }