MSBuild与Visual Studio-编译方面的差异? [英] MSBuild Vs Visual Studio - Differences in compilation?

查看:115
本文介绍了MSBuild与Visual Studio-编译方面的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Visual Studio 2015和本地TFS 2013服务器为旧版VB.Net ASP.Net Forms应用程序设置持续集成过程.但是,我无法获得构建定义来成功构建我的应用程序.

I'm attempting to set up a Continuous Integration process for a legacy VB.Net ASP.Net Forms application, using Visual Studio 2015 and an on premises TFS 2013 server. However, I'm failing to get a Build Definition to successfully build my application.

这是一个XAML生成定义,每次TFS签入时都会触发该事件,但是到目前为止,由于编译组件项目时出现错误,并带有与属性相关的错误(例如'Extended Properties cannot be initialized'),导致构建应用程序失败.

It's a XAML Build Definition, which triggers happily on every TFS check in, but has so far failed to build the application, due to errors compiling a component project with Property-related errors like 'Extended Properties cannot be initialized'.

所有项目都可以在Visual Studio中愉快地编译,所以我猜这些错误实际上是由于vbc.exe编译器的版本或MSBuild使用的编译器选项引起的?

The projects all compile happily within Visual Studio, so I'm guessing these errors are actually due to the version of the vbc.exe compiler, or the compiler options being used by MSBuild?

我试图将项目中使用的相同编译器设置传递给MSBuild参数(请参见下文),但没有成功.

I've tried to pass the same compiler settings used in the project to the MSBuild arguments (see below), but without success.

/p:OptionStrict=false /p:OptionInfer=false /p:OptionExplicit=true /p:OptionCompare=binary

主应用程序项目具有在项目文件中指定的以下ToolsVersion,但是Visual Studio可以实际使用不是MSBuild的更高版本(14或15?)吗?

The main application project has the following ToolsVersion, specified in the project file, but could Visual Studio actually using a later version (14 or 15?) which MSBuild isn't?

<Project DefaultTargets="Build" ToolsVersion="12.0"

对于为什么要在Visual Studio中完美构建而不是在构建定义"中构建该项目的任何建议,将深表感谢.

Any suggestions of why this project would build perfectly in Visual Studio, but not in the Build Definition would be hugely appreciated.

推荐答案

就像我评论的那样,这里的棘手部分是确定正确的MSBuild工具版本,然后以正确的方式使用它.

Like I commented, the tricky part here is to determine the right MSBuild tooling version and then use it in the right way.

首先,很难记住其Visual Studio版本的MSBuild版本号.您可以使用Google,以下只是一些参考,

First it would be hard to remember the MSBuild version number for their Visual Studio releases. You can use Google and below is just some for reference,

  • Visual Studio 2015-MSBuild 14
  • Visual Studio 2017-MSBuild 15

确保它们存在于执行构建的机器上.

Make sure they exist on the machine who executes the build.

第二,您可能需要覆盖工具版本(根据本文).

Second, you might need to override the tooling version (per this article).

这篇关于MSBuild与Visual Studio-编译方面的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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