我正在尝试在我的 Visual Studio 2015 (TACO) 项目中使用 pre 和 post build。正如Visual Studio 2015 Tools for Apache Cordova 上的 PreBuildEvent 和 PostBuildEvent中所述,我已将<Target>
元素添加到我的 .jsproj 文件中,因此它现在结束,如下所示:
<Import Project="_apacheCordovaProjectSourceItems.Targets" Condition="Exists('_apacheCordovaProjectSourceItems.Targets')" />
<Target Name="BeforeBuild">
<Exec Command="if $(ConfigurationName) == Release (echo ** Before Build **)" />
<Exec Command="attrib -R "$(ProjectDir)\platforms\*.*" /S" IgnoreExitCode="true" />
</Target>
<Target Name="AfterBuild">
<Exec Command="if $(ConfigurationName) == Release (echo ** After Build **)" />
<Exec Command="if $(ConfigurationName) == Release (xcopy "$(TargetDir)*.*" "$(SolutionDir)..\..\Binaries\$(PlatformName)\*.*" /Y /S /E /F /I)" />
</Target>
</Project>
我的问题是 BeforeBuild 和 AfterBuild 事件都在构建开始时触发
1>------ Build started: Project: MyProject, Configuration: Release Android ------
1> ** Before Build **
1> ** After Build **
1> D:\Workspaces\Products\MyProduct\Projects\Main\Sources\Apps\MyProject\bin\Android\Release\android-release-unsigned.apk -> D:\Workspaces\Products\MyProduct\Projects\Binaries\Android\android-release-unsigned.apk
1> D:\Workspaces\Products\MyProduct\Projects\Main\Sources\Apps\MyProject\bin\Android\Release\manifest-merger-release-report.txt -> D:\Workspaces\Products\MyProduct\Projects\Binaries\Android\manifest-merger-release-report.txt
1> 2 File(s) copied
1> Your environment has been set up for using Node.js 0.12.2 (ia32) and npm.
1> ... [Rest of output omitted] ...
任何人都可以解释为什么会这样,或者我如何在构建完成后让构建后事件运行?