在Visual Studio 2008中构建解决方案后,是否可以运行外部可执行文件? [英] Is there a way to run an outside executable after a solution is built in Visual Studio 2008?

查看:67
本文介绍了在Visual Studio 2008中构建解决方案后,是否可以运行外部可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是在谈论项目的构建后活动。相反,我想在构建整个解决方案后自动运行可执行文件。有没有办法为该解决方案进行构建后事件?

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?

推荐答案

Visual Studio 2010和之前的版本



您可以通过在宏编辑器中处理OnBuildDone来执行此操作。该事件为您提供了一些方便的属性,您可以检查它们:作用域(项目/解决方案/批处理)和操作(构建/重建/清理/部署)。要执行您想要的操作,将是这样的(未经测试,请记住):

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



以上解决方案在Visual Studio 2012中无法使用,因为Microsoft已删除该版本中的宏。但是,您仍然可以使用外接程序执行基本相同的操作。要查看操作方法,请转到此处:

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:

替代Visual Studio 2012中的宏

这篇关于在Visual Studio 2008中构建解决方案后,是否可以运行外部可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆