Last active
December 18, 2015 20:29
-
-
Save wwwlicious/5840977 to your computer and use it in GitHub Desktop.
Creates a VS solution folder if it does not exist when passed a EnvDTE80.Solution2 object and a folder name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-SolutionFolder { | |
[CmdletBinding()] | |
param( | |
[Parameter(Position=0, Mandatory=$true)] | |
$solution, | |
[Parameter(Position=1, Mandatory=$true)] | |
[string]$folderName | |
) | |
$exists = $false | |
Foreach($project in $solution.Projects) { | |
if($project.Kind.Equals([EnvDTE80.PROJECTKINDS]::vsProjectKindSolutionFolder)) | |
{ | |
if ($project.Name.Equals($folderName)) | |
{ | |
$exists = $true | |
} | |
} | |
} | |
if(!$exists) { | |
# Create the solution folder. | |
Write-Host "Creating solution folder: ", $folderName | |
$parentProject = $solution.AddSolutionFolder($folderName) | |
} | |
else { | |
Write-Host "Solution folder already exists: ", $folderName | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment