Day to day I find myself using Git natively as well as Atlassian’s SourceTree Git client. Keen to ever ease my life with SourceTree I’ve previously written custom actions to open the associated FogBugz case to a commit as well as another custom action to update all or certain NuGet packages for a repository.
Following on from this I have now created another custom action which I wanted to share that allows me to open solution files by simply right clicking on the repository and choosing my new custom action.
As you can see from the below script this is accomplished extremely easy, in fact in a single line of PowerShell which takes a single input parameter called ‘Repo’.
If copying and pasting isn’t your game then you can also find the script in my PowerShell Tools repository on GitHub along with my previous creations.
Setting the script as a custom action up in SourceTree is also extremely easy. Below is a screenshot of the options you need in order to get the custom action setup. Simply replace ‘C:\scripts...’ with the location of where you have saved the script.
Once you have the custom action setup then it can be accessed by right clicking on the repository or a commit and choosing the new custom action called ‘Open Solution’ from within the ‘Custom Actions’ menu.
The solution files if found will then be opened in the default program associated with the file extension.