Skip to content

Instantly share code, notes, and snippets.

@zettoone
Created May 8, 2013 03:20
Show Gist options
  • Save zettoone/5537955 to your computer and use it in GitHub Desktop.
Save zettoone/5537955 to your computer and use it in GitHub Desktop.
' Open the Macro Explorer (Tools/Macros/Macro Explorer), create a new Module, and add the following subroutine:
Sub RunPremake()
If Not DTE.Solution Is Nothing And Not String.IsNullOrEmpty(DTE.Solution.FullName) Then
Dim solutionPath, solutionDir, premakeTarget, premakeFlags, premakeExePath, premakeScriptDir As String
solutionPath = DTE.Solution.FullName
solutionDir = solutionPath.Substring(0, solutionPath.LastIndexOf("\"))
premakeTarget = solutionDir.Substring(solutionDir.LastIndexOf("\") + 1)
' You might need to adjust these
premakeFlags = ""
premakeExePath = "C:\premake\premake4.exe" ' need to be changed
premakeScriptDir = solutionDir + "\..\.." ' need to be changed
DTE.ExecuteCommand("File.CloseSolution")
ChDir(premakeScriptDir)
Dim command As String
command = premakeExePath + " " + premakeFlags + " " + premakeTarget
Shell(command, AppWinStyle.NormalFocus, True)
DTE.Solution.Open(solutionPath)
Else
MsgBox("No solution!")
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment