Is there a way to run an outside executable after a solution is built in Visual Studio 2008?

后端 未结 2 1270
梦如初夏
梦如初夏 2021-02-07 06:47

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

2条回答
  •  后悔当初
    2021-02-07 06:53

    Visual Studio 2010 and before

    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
    

    Visual Studio 2012

    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

提交回复
热议问题