3
votes

I have a C# project developed with VS2017.

The server on which Jenkins runs doesn't have VS installed. I have .NET 4.7 installed on the dev computer and the server.

This is what I get when I type msbuild.exe /version:

Microsoft (R) Build Engine version XXX(see below)

  • On dev, I have 2 MSBUILD.exe:

    • C:...\MicrosoftVisualStudio\2017\Pro\MSBuild\15.0\Bin: 15.1.1012.6693
    • C:\Windows\Microsoft.NET\Framework\v4.0.30319: 4.7.2053.0
  • On server: C:\Windows\Microsoft.NET\Framework\v4.0.30319: 4.7.2053.0

I assume that when I build a project in VS2017, it uses the MSBUILD.exe located in the MicrosoftVisualStudio folder.

I'm concerned now to build on the Jenkins machine with a different version of MSBUILD.exe? What would be the best approach? Copy the folder C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild to the Jenkins computer?

2
Either you use Visual Studio folder MsBuild.exe or .Net framework MsBuild it doesn't matter as long as the resolving dependencies available.Suresh

2 Answers

0
votes

This depends on what MSBuild features you use.

The safe way to build projects developed in VS 2017 is to build using the installed VS version of MSBuild (15) from either a full VS installation or the Build Tools for Visual Studio 2017.

Even though the .NET Framework version of MSBulid will be able to build a lot of projects, it is limited to an older C# version, so you'd have to install the Microsoft.Net.Compilers NuGet package to replace the compiler. But VS 2017 introduces new MSBuild syntax features as well as build tasks which cannot be patched into the legacy version of MSBuild so its use is highly discouraged.

0
votes

I was getting several errors using on the server this version of MSBUILD.exe: C:\Windows\Microsoft.NET\Framework\v4.0.30319: 4.7.2053.0

Here are the steps followed to builwithout error a VS2017 C# on Jenkins 2.60.2

  1. Copy C:...\MicrosoftVisualStudio\2017\Pro\MSBuild to my server
  2. In Jenkins/Global Tool Configuration, in the MSBUILD section

    • Name: msbuild.exe
    • Path to MSBuild: C:\MSBuild\15.0\Bin
    • Default parameters: -p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7"

If Default parameters is empty, I was getting errors, so it is important.