立即停止处理的MSBuild的编译错误 [英] Stop MSBuild processing immediately on compilation errors

查看:480
本文介绍了立即停止处理的MSBuild的编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写一个批处理文件,在执行时生成一个Visual Studio解决方案。该解决方案包括几个C#项目。我使用的MSBuild工具这一点。如何从进一步继续停止构建的时候有任何项目的编译错误?
另外我怎么能得到错误信息,并在命令提示符下显示出来?

I have written a batch file, which when executed builds a visual studio solution. The solution comprises of few C# projects. I am using MSBuild utility for this. How can i stop the build from proceeding further when there are compilation errors in any of the projects? Further how can i get the error messages and display them on command prompt?

推荐答案

有建立一个Visual Studio解决方案时,是在第一次失败的站不支持。

There's no support for stop on first failure when building a visual studio solution.

您可以通过以下步骤解决此:

You can workaround this by taking the following steps:


  1. 环境变量msbuildemitsolution设置为1(设置msb​​uildemitsolution = 1 );

  2. 调用的MSBuild以便产生来自目标的* .proj文件VS溶液

  3. 在名为构建目标生成* .sln.proj文件更改 RunEachTargetSeparately =真正的 RunEachTargetSeparately =FALSE;

  4. 调用的MSBuild建立更新的* .sln.proj文件。

  1. Set the environment variable msbuildemitsolution to 1 (set msbuildemitsolution=1);
  2. Invoke MSBuild in order to generate a *.proj file from the target VS solution;
  3. In the generated *.sln.proj file change RunEachTargetSeparately="true" in the target named Build to RunEachTargetSeparately="false";
  4. Invoke MSBuild to build the updated *.sln.proj file.

这答案是基于<一个href=\"http://social.msdn.microsoft.com/Forums/en/msbuild/thread/2e4e255a-f84a-4ad5-8190-de37bbdb7fdc\"相对=nofollow> 丹·莫斯利的回答对MSDN论坛一个帖子的。

This answer is based on Dan Moseley answer to a post on MSDN Forums.

这篇关于立即停止处理的MSBuild的编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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