MSBuild AfterBuild消息不显示实时 [英] MSBuild AfterBuild messages not showing real-time

查看:117
本文介绍了MSBuild AfterBuild消息不显示实时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Visual Studio 2012中的ASP.NET MVC 4项目,.csproj文件中具有以下内容:

I have something like the following in the .csproj file for an ASP.NET MVC 4 project in Visual Studio 2012:

<Target Name="AfterBuild">
  <CallTarget Targets="InstallBuildDependencies" />
  <CallTarget Targets="BuildAssets" />
</Target>
<Target Name="InstallBuildDependencies">
  <Message Text="Installing build dependencies:" Importance="high" />
  <Exec Command="npm install" />
</Target>
  <Target Name="BuildAssets">
  <Message Text="Building assets:" Importance="high" />
  <Exec Command="grunt build" />
</Target>

以及在.pubmxl中针对同一项目的类似内容:

and something like this in a .pubmxl for the same project:

  <PropertyGroup>
    <!-- Other properties here -->
    <InstallBuildDependenciesCmd>npm install</InstallBuildDependenciesCmd>
    <BuildDistAssetsCmd>grunt dist</BuildDistAssetsCmd>
    <PipelineDependsOn>
      InstallBuildDependencies;
      BuildDistAssets;
    </PipelineDependsOn>
  </PropertyGroup>
  <Target Name="InstallBuildDependencies">
    <Message Text="Installing build dependencies:" Importance="high" />
    <Exec Command="$(InstallBuildDependenciesCmd)" />
  </Target>
  <Target Name="BuildDistAssets" AfterTargets="InstallBuildDependencies">
    <Message Text="Building distribution assets:" Importance="high" />
    <Exec Command="$(BuildDistAssetsCmd)" />
  </Target>

问题在于,在第一个代码段中,直到构建中的所有内容都完成,在Visual Studio的Ouput控制台中没有任何消息或命令的输出显示.这是不理想的,因为最好以实时"方式查看消息和命令输出.

The issue is that, in the first snippet, none of the messages or output from the commands displays in the Ouput console in Visual Studio until everything in the build has finished. This is not ideal since it would be better to see the messages and command output in "real-time".

在第二个片段中,消息和命令输出DO均在输出"控制台中实时"显示.

In the second snippet, both the messages and command output DO show in "real-time" in the Output console.

是否有可能像第二个片段中的消息一样从第一个第一片段中获得消息进行实时显示?为什么我会遇到这种不一致的情况?

Is it possible to get the messages from the first first snippet to display in real-time like the messages in the second snippet do? Why am I experiencing this inconsistency?

推荐答案

超级迟来的答案,但最近却遇到了同样的问题. 根据 Exec Task文档备注部分中的a>:

Super late answer, but recently stumbled with this same issue. It seems that this is not possible, according to the Exec Task documentation in the Remarks section:

但是,与更具体的任务不同,Exec任务无法从其运行的工具或命令中收集输出.

However, the Exec task, unlike a more specific task, cannot gather output from the tool or command that it runs.

希望这可以为其他人节省一些时间.

Hope this saves some time for anyone else.

这篇关于MSBuild AfterBuild消息不显示实时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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