简体   繁体   中英

Visual Studio - Make Add-in run automatically after build

I have ac# add-in that I would like to run automatically after a user builds a solution. Is there a possible way to implement this?

So far, after looking online, I've found:

  • http://msdn.microsoft.com/en-us/library/envdte.buildeventsclass.onbuilddone.aspx - This is the documentation for the BuildEventsClass.OnBuildDone Event. However, it says at the beggining that "This API supports the .NET Framework infrastructure and is not intended to be used directly from your code."

  • Custom Build Tools in msBuild. If I use this option, does my add-in have to be able to be run from the command line?

I think you've found two valid solutions. If your tool is a plug-in to visual studio, you can use the first method. Don't worry about the warning, that's saying you can't call it from your application code. But you _ can_ call it from a macro project, or other code designed to extend visual studios capabilities. . Go up a few levels in the doc tree at the link you gave and read about extending the development environment.

On the other hand, if your add-on does have a command line interface, the 2nd method is an extremely easy to add a step to your build. I always do it this way.

您可以实现IVsUpdateSolutionEvents并与注册IVsSolutionBuildManager挂钩到生成的事件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM