MSBuild Vs Visual Studio - Differences in compilation?

限于喜欢 提交于 2019-12-24 07:34:43

问题


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.

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'.

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?

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

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"

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


回答1:


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

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).



来源:https://stackoverflow.com/questions/42787906/msbuild-vs-visual-studio-differences-in-compilation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!