简体   繁体   中英

MSBuild Vs Visual Studio - Differences in compilation?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM