//Get the current workspace var workspace = VisualStudioWorkspace.Create(); //Create a new project var project = Project.Create("MyProject", "C#"); //Add the project to the workspace workspace.AddProject(project);
//Get the current workspace var workspace = VisualStudioWorkspace.Create(); //Create a new solution folder var folder = SolutionFolder.Create("MyFolder"); //Add the folder to the workspace workspace.AddSolutionFolder(folder);
//Get the current workspace var workspace = VisualStudioWorkspace.Create(); //Create a new code file var file = CodeFile.Create("MyFile.cs"); //Add the file to the workspace workspace.AddDocument(file);These examples use the Microsoft.CodeAnalysis.Workspaces package library.