PowerShell function to open the first Visual Studio solution file found within the current directory.
@{
RootModule = 'Open-Solution.psm1'
ModuleVersion = '0.1.0'
GUID = '42f8cad0-c32a-4ccd-9401-de4bdbafdd65'
Author = 'Nick Spreitzer'
FunctionsToExport = @('Open-Solution')
AliasesToExport = @('sln')
}function Open-Solution() {
param(
[string]$RootDirectory = ''
)
$solutions = Get-ChildItem -recurse -path "$RootDirectory*.sln"
if ($solutions.Count -eq 1) {
& $solutions.FullName
}
elseif ($solutions.Count -eq 0) {
write-host "I couldn't find any solution files here!"
}
elseif ($solutions.Count -gt 1) {
write-host "I found more than solution. Which one do you want to open?"
$solutions | ForEach-Object { write-host " - $($_.FullName)" }
}
}
Set-Alias sln Open-SolutionRather than navigating around Windows explorer, looking for that pesky .sln file you want to open, why not just open in from your command line? This module allows you to type sln from your PowerShell terminal window to open the first .sln file found within the current directory or any of its children.
\Documents\WindowsPowerShell\Modules\Open-Solution.sln.sln <PATH_TO_DIRECTORY_CONTAINING_VS_SOLUTION_FILE_AT_ANY_DEPTH>Install-Module -Name WhatsNew. https://github.com/refactorsaurusrex/whats-newsln.