Skip to content

Instantly share code, notes, and snippets.

@glucaci
Last active May 22, 2019 13:00
Show Gist options
  • Save glucaci/7c99fec4a63e0e05eef2bd71741a2de3 to your computer and use it in GitHub Desktop.
Save glucaci/7c99fec4a63e0e05eef2bd71741a2de3 to your computer and use it in GitHub Desktop.

Revisions

  1. glucaci revised this gist May 22, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion VisualStudioSolutionFinder.ps1
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    # This function can be places in C:\Users\<YourUser>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
    # and used in any directory with Visual Studio Solutions

    function s {
    $solutionFiles = Get-ChildItem -Path .\ -Filter *.sln -Recurse
  2. glucaci revised this gist May 22, 2019. 1 changed file with 15 additions and 4 deletions.
    19 changes: 15 additions & 4 deletions VisualStudioSolutionFinder.ps1
    Original file line number Diff line number Diff line change
    @@ -3,15 +3,26 @@

    function s {
    $solutionFiles = Get-ChildItem -Path .\ -Filter *.sln -Recurse
    For ($i=1; $i -le $solutionFiles.Count; $i++) {
    Write-Host $i $solutionFiles[$i-1].Name

    if ($solutionFiles.Count -lt 1) {
    Write-Host "Coudn't find any solution file in the current directory."
    return
    }

    if ($solutionFiles.Count -lt 2) {
    $solutionNumber = 1
    }
    else {
    For ($i=1; $i -le $solutionFiles.Count; $i++) {
    Write-Host $i $solutionFiles[$i-1].Name
    }

    $solutionNumber = Read-Host -Prompt 'Select solution to open'
    $solutionNumber = Read-Host -Prompt 'Select solution to open'
    }

    $solutionToOpen = $solutionFiles[$solutionNumber - 1]
    $fullPath = Join-Path -Path $solutionToOpen.Directory.FullName $solutionToOpen.Name

    Write-Output "Opening $fullPath"
    ii $fullPath
    Start-Process $fullPath
    }
  3. glucaci created this gist May 17, 2019.
    17 changes: 17 additions & 0 deletions VisualStudioSolutionFinder.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    # This function can be places in C:\Users\<YourUser>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
    # and used in any directory with Visual Studio Solutions

    function s {
    $solutionFiles = Get-ChildItem -Path .\ -Filter *.sln -Recurse
    For ($i=1; $i -le $solutionFiles.Count; $i++) {
    Write-Host $i $solutionFiles[$i-1].Name
    }

    $solutionNumber = Read-Host -Prompt 'Select solution to open'

    $solutionToOpen = $solutionFiles[$solutionNumber - 1]
    $fullPath = Join-Path -Path $solutionToOpen.Directory.FullName $solutionToOpen.Name

    Write-Output "Opening $fullPath"
    ii $fullPath
    }