I’m running roslyn ctp2
I am attempting to add a new html file to a project
IWorkspace workspace = Workspace.LoadSolution("MySolution.sln");
var originalSolution = workspace.CurrentSolution;
ISolution newSolution = originalSolution;
newSolution.GetProject(newSolution.ProjectIds.First())
.AddDocument("index.html", "<html></html>");
workspace.ApplyChanges(originalSolution, newSolution);
This results in no changes being written. I am trying to get the new html file to appear in VS
There are two issues here:
ISolution,IProject, andIDocumentobjects are immutable, so in order to see changes you would need to create a newISolutionwith the changes, then callWorkspace.ApplyChanges().IDocumentobjects are only created for files that are passed to the compiler. Another way of saying this is things that are part of theCompileItemGroupin the project file. For other files (including html files), you should use the normal Visual Studio interfaces likeIVsSolution.