I'm not talking about a post build event for a project. Rather, I want to run an executable automatically after the entire solution is built. Is there a way to do a post build event for the solution?
In Visual Studio, select File > Open > Project. In the Open Project dialog box, select All Project Files, if not already selected, in the dropdown next to File name. Navigate to the .exe file, select it, and select Open.
Just use File/Open Project/Solution, select EXE file and Open it. Then select Debug/Start debugging. The other option is to run the EXE first and then Select Debug/Attach to process.
In Visual Studio you can open any EXE as a 'project'. Just go to File->Open->Project/Solution and browse to the .exe file.
Some of these files are the files that you create for your C code. Other files include the "object" files created by the compiler when you code is compiled, the "executable" file (*.exe) that Visual Studio creates by linking your compiled code with other code, libraries, etc.
You can do this in the Macro Editor by handling OnBuildDone. The event gives you a couple of handy properties you can check: scope (project/solution/batch) and action (build/rebuild/clean/deploy). To do what you want would be something like this (not tested, mind):
Public Sub AfterBuild(scope As vsBuildScope, action As vsBuildAction) _
Handles BuildEvents.OnBuildDone
If scope = vsBuildScope.vsBuildScopeSolution Then
System.Diagnostics.Process.Start("some file I want to run")
End If
End Sub
The solution above won't work in Visual Studio 2012 because Microsoft has removed macros in that version. However, you can still do essentially the same thing with an add-in. To see how, go here:
Alternative to Macros in Visual Studio 2012
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With