Skip to content

Instantly share code, notes, and snippets.

@motowilliams
Created February 13, 2012 23:47
Show Gist options
  • Save motowilliams/1821540 to your computer and use it in GitHub Desktop.
Save motowilliams/1821540 to your computer and use it in GitHub Desktop.
Test craplet to look at closing solution, change branch, open solution
using System;
using EnvDTE;
namespace VSBouncer
{
class Program
{
static void Main(string[] args)
{
var command = args[0];
var solutionPath = args[1];
DTE dte = (DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0");
var solution = dte.Solution;
var fullPath = System.IO.Path.GetFullPath(solutionPath);
if (command.Equals("open", StringComparison.OrdinalIgnoreCase))
solution.Open(fullPath);
if (command.Equals("close", StringComparison.OrdinalIgnoreCase))
solution.Close(true);
}
}
}
@motowilliams
Copy link
Author

Trying to get a way to keep branch chaning from sucking w/ VS and git. Just messing around and calling this craplet before and after some very hard-coded command line goo worked. I though it might be a good pre-checkout git hook but that doens't exist. Then thought maybe a posh-git interceptor or something. Maybe it just needs to be a hi-jacked git alias?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment