This has proved to be more difficult that I thought. $dte doesn't support all the interfaces you'd expect. You have to derive a Solution2 COM interface before you can manipulate the solution directly. This, for example is how you add a file at solution level:
$vsSolution = Get-Interface $dte.Solution ([EnvDTE80.Solution2])
$vsProject = $vsSolution.AddSolutionFolder("newFolder")
$projectItems = Get-Interface $vsProject.ProjectItems ([EnvDTE.ProjectItems])
$projectItems.AddFromFile("greenery.txt")
It's still nicer than having to parse the solution file all the same. More on this as the project develops.
No comments:
Post a Comment