Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adding a solution folder via DTE in NuGet
function Add-SolutionFolder {
param(
[string]$Name
)
$solution2 = Get-Interface $dte.Solution ([EnvDTE80.Solution2])
$solution2.AddSolutionFolder($Name)
}
function Get-SolutionFolder {
param (
[string]$Name
)
$solution2.Projects | ?{ $_.Kind -eq [EnvDTE80.ProjectKinds]::vsProjectKindSolutionFolder -and $_.Name -eq $Name }
}
# Adding a solution folder and a file
$sf = Add-SolutionFolder folder
# Pass the absolute path to the file
$sf.ProjectItems.AddFromFileCopy("c:\Foo.proj")
# Removing
$sf = Get-SolutionFolder folder
$dte.Solution.Remove($sf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment