Visual Studio Build行为不同于TFS Build和MSBuild [英] Visual studio Build behavior different from TFS Build and MSBuild

查看:79
本文介绍了Visual Studio Build行为不同于TFS Build和MSBuild的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在VS 2008中的VC ++项目的构建自动化中遇到了这个问题.

推荐答案

对于Visual Studio 2008,MSBuild实际不构建Visual C ++项目.这是通过另一个名为VCBuild的构建系统完成的. (通过MSBuild构建解决方案时,会发生正确的事情,并且会调用VCBuild.)

如果您从命令行调用MSBuild,并且想要确保您进行重建,则可以使用:

   msbuild myproject.csproj/t:Rebuild

这将调用清理然后生成.但是,听起来您正在对.vcproj文件进行更改,然后调用MSBuild.当您进行更改时.

今天晚上在Visual Studio 2008中玩此游戏时,我注意到我是在NotePad中加载.vcproj,并像Visual Studio一样更改配置(我添加了预处理程序定义)并保存文件,然后我使用MSBuild(没有/t:rebuild开关)构建了解决方案(我以前构建并是最新的),VCBuild确实捕获了更改并重新构建了项目.第二次构建表明该项目是最新的.

如果我同时拉起IDE和命令提示符,并使用MSBuild进行构建,直到所有内容都报告为最新的,然后转到Visual Studio并添加预处理程序定义",然后在单击确定"并关闭选项"对话框并键入MSBuild后直接转到命令提示符,该项目仍显示为最新.即使单击全部保存(多磁盘)"图标,该项目仍显示为最新.

这可能是VCBuild中的问题.但是,在调用MSBuild之前,Visual Studio使用了特殊的最新检查.这种机制可能会以某种方式覆盖VCBuild所需的信息.

但是,MSBuild完全支持Visual Studio 2010的新增功能Visual C ++项目.在这种情况下,MSBuild使用获得可靠的增量构建的专利技术.过去,C ++项目系统往往会过度或过度构建项目.因此,许多C ++开发人员已经采取了简单的重建措施来保证干净的构建.现在这已成为过去.

新技术可以跟踪文件活动并维护内部版本之间的信息.下次构建时,如果有任何更改,则会构建从属部分.另请注意,无需为每个文件指定依赖项. MSBuild为您解决.

Chuck England
Visual Studio Platform
程序管理器-MSBuild

For Visual Studio 2008, MSBuild does not actually build Visual C++ projects. This is done by another build system called VCBuild. (When you build a solution via MSBuild, the right things happen, and VCBuild is called.)

If you are invoking MSBuild from the command line, and want to make sure you rebuild, you can use:

   msbuild myproject.csproj /t:Rebuild

This will invoke a clean and then build. However, it sounds like you are making a change to the .vcproj file, and then invoking MSBuild. When you make the change.

In playing with this in Visual Studio 2008 this evening, I noted that is I load up the .vcproj in NotePad, and change the configuration like Visual Studio would do (I added a pre-processor definition) and saved the file, then I built the solution (which I had previsouly built and was up-to-date) with MSBuild (without the /t:rebuild switch), VCBuild did catch the change and rebuild the project. Building a second time showed that the project was up-to-date.

If I pull up the IDE, and a command prompt simultaneously, and build using MSBuild until everything is reported as up-to-date, then go to Visual Studio and add the Preprocessor Definintion, then go straight to the command prompt after hitting Ok and dismissing the Options dialog, and typing MSBuild, the project still shows up to date. Even if I click the Save All (multi-disk) icon, the project still shows up-to-date.

This may be an issue in VCBuild. However, there is special up-to-date check the Visual Studio uses prior to invoking MSBuild. It is possible that this mechanism is somehow over-writing the information that VCBuild needs.

However, new for Visual Studio 2010, Visual C++ projects are fully supported by MSBuild. In this case, MSBuild uses a patented technology which provides Reliable Incremental builds. In the past C++ project systems tend to over or underbuild projects. So, many C++ developers have resorted to simply rebuilding to guarantee clean builds. This is now a thing of the past.

The new technology tracks the file activity and maintains the information between builds. The next time you build, if anything changed, then the dependent pieces are built. Also note that there is no need to specify dependencies for each file. MSBuild figures it out for you.

Chuck England
Visual Studio Platform
Program Manager - MSBuild


这篇关于Visual Studio Build行为不同于TFS Build和MSBuild的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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