PostBuildEvent和AfterBuild目标之间的Vi

PostBuildEvent和AfterBuild目标之间的Vi

本文介绍了PostBuildEvent和AfterBuild目标之间的Visual Studio项目文件差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

有人可以解释它们之间的区别吗?

can someone explain the differences between these:

<Target Name="AfterBuild">
    <!-- task here -->
</Target>

和:

<PropertyGroup>
<PostBuildEvent>copy "$(ProjectDir)\..\lib\$(PlatformName)\x.dll" .</PostBuildEvent>
</PropertyGroup>

谢谢.

推荐答案

PostBuildEvent属性能够保存作为Command属性传递给Exec任务的命令.本质上,您最终会找到一个看起来像这样的目标,

The PostBuildEvent property is able to hold a command that is passed as the Command attribute to an Exec task. Essentially you end up with a target that looks like this,

<Target Name="PostBuildEvent">
   <Exec Command="$(PostBuildEvent)" />
</Target>

您可以配置条件,使其在IDE中通过设置运行,默认情况下,它仅在成功的构建上运行.

You can configure the conditions when this will be run with a setting in the IDE, by default it only runs on a successful build.

AfterBuild目标能够包含任意MSBuild任务,包括一个或多个Exec任务或MSBuild可用的任何其他任务,这会增加复杂性.

The AfterBuild target is able to contain arbitrary MSBuild tasks, including one or more Exec tasks or any other task available to MSBuild, which allows for greater complexity.

就执行时间而言,PostBuildEvent目标将在"CoreBuild"之前运行,而"AfterBuild"目标将在"CoreBuild"之后运行.如果放置至关重要,则可以使用$(DependsOn ..)声明,或在新目标上指定BeforeTargets和AfterTargets,制作自己的目标并将其连接到需要运行的构建中的任何位置.

In terms of when they are executed, the PostBuildEvent target runs just prior to "CoreBuild" while the "AfterBuild" target will run after "CoreBuild". If the placement is critical, you can make your own target and wire it into whereever in the build you need it to run, using the $(DependsOn..) declarations, or by specifying BeforeTargets and AfterTargets on your new target.

这篇关于PostBuildEvent和AfterBuild目标之间的Visual Studio项目文件差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:12