Open visual studio from powershell

If you are like me, you spend some time working with your source control from the command line (powershell in my case). Often after i have navigated to a folder and synced in changes i want to open the solution contained somewhere below the folder i am currently in.

This function will open up the first available solution file under your current directory in visual studio

function sln 
{ 
    $file = Get-ChildItem -recurse *.sln | Select-Object -First 1
    if($file)
    {
        start -FilePath $file.FullName
    }
}

So stick this snippet in your powershell profile and be on your merry way!


January 11, 2015