-1

Trying to add external command Clean + Rebuild both in a single click.

Was not found the solution from this question: Clean and build in one Macro

doing the same as suggested in it, still not found the exact solution.

What i have tried is

1.Make a Notepad file with Name command.exe, and add this code in it

Public Sub ReleaseBuild()
   DTE.Solution.SolutionBuild.Clean(True)
   DTE.Solution.SolutionBuild.Build(True)    
End Sub

Public Sub DebugBuild()
   DTE.Solution.SolutionBuild.Clean(True)
   DTE.Solution.SolutionBuild.Build(True)
End Sub

2. Then add a command in External Tools

enter image description here

3. Assign a shortcut to the Command

As my External tool no is 4(By Index), i have add this command to ExternalCommand4

enter image description here

And the error occurred when i hit the shortcut.

enter image description here

Can anybody tell me where i am wrong??

Community
  • 1
  • 1
Smit Patel
  • 2,992
  • 1
  • 26
  • 44

1 Answers1

1

You get this message

enter image description here

because you are trying to execute command.exe file with text contents:

Public Sub ReleaseBuild()
   DTE.Solution.SolutionBuild.Clean(True)
   DTE.Solution.SolutionBuild.Build(True)    
End Sub

Public Sub DebugBuild()
   DTE.Solution.SolutionBuild.Clean(True)
   DTE.Solution.SolutionBuild.Build(True)
End Sub

Just renaming text file into .exe doesn't make it executable. You are supposed to either compile it or use a script engine.

enkryptor
  • 1,574
  • 1
  • 17
  • 27