MSBuild AfterBuild Step

假如想象 提交于 2019-12-02 10:02:56

A project can have only one AfterBuild target. Placement is critical, make sure it appears after any <Import> directive so you can be sure it is last and the default one is overridden. Bump up the priority of the <Message> so you can always see it.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   ...
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   ...
   <Target Name="AfterBuild">
     <Message Importance="High" Text="It works"/>
   </Target>
</Project>

Output:

1>------ Build started: Project: ConsoleApplication317, Configuration: Debug Win32 ------
1>  ConsoleApplication317.vcxproj -> C:\projects2\ConsoleApplication317\Debug\ConsoleApplication317.exe
1>  It works
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!