未调用所有目标(未执行嵌套目标) [英] All Targets Not Being Called (nested Targets not being executed)

查看:92
本文介绍了未调用所有目标(未执行嵌套目标)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用两个TARGET文件.在一个TARGET文件上,我调用了第二个TARGET文件中的TARGET.然后,第二个TARGET调用另一个具有6个TARGET调用的TARGET,它们执行许多不同的操作(除了调用其他嵌套的TARGETS(但在同一个TARGET文件中)).问题在于,在我称为6个目标的目标上,仅第一个目标正在执行.程序找不到调用第二,第三,第四,第五和第六个目标的方式.可以调用和运行的嵌套TARGETS的数量是否有限制?一切都没有失败.问题是其他TARGET调用未运行.感谢您提供的任何帮助.

I am using a two TARGET files. On one TARGET file I call a TARGET that is inside the second TARGET file. This second TARGET then calls another TARGET that has 6 other TARGET calls, which do a number of different things (in addition to calling other nested TARGETS (but inside the same TARGET file)). The problem is that, on the TARGET where I call 6 TARGETS, only the first one is being executed. The program doesnt find its way to call the 2nd, 3rd, 4th, 5th, and 6th TARGET. Is there a limit to the number of nested TARGETS that can be called and run? Nothing is failing. The problem is the other TARGET calls are not running. Thanks for any help you can provide.

推荐答案

嵌套目标的数量没有限制.您是否尝试过使用所有日志运行msbuild来查看为何未调用目标的原因:

There is no limit to the number of targets nested. Have you tried running msbuild with all the log to see why the targets are not called :

msbuild [project.file] /verbosity:detailed 

我认为这是由于条件未满足(目标上的Condition属性),输入不变(目标上的Input属性)或者您试图多次调用同一目标所致.

I think this is due to unfulfilled condition (Condition attribute on target), unchanged input (Input attribute on target) or you are trying to call the same target multiples times.

  • 使用MSBuild任务:

<!-- The target we want to execute multiple times -->
<Target Name="VeryUsefulOne">
  <Message Text="Call VeryUsefulOne Target"/>
</Target>

<Target Name="One">
  <Message Text="One"/>
  <MSBuild Targets="VeryUsefulOne"
           Properties="stage=one" 
           Projects="$(MSBuildProjectFile)"/>
</Target>

<Target Name="Two">
  <Message Text="Two"/>
  <MSBuild Targets="VeryUsefulOne"
           Properties="stage=two" 
           Projects="$(MSBuildProjectFile)"/>
</Target>

<Target Name="OneTwo">
  <CallTarget Targets="One;Two"/>
</Target>

在两次通话之间更改Properties值很重要.

It's important to change Properties value between call.

这篇关于未调用所有目标(未执行嵌套目标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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