Monday, 20 May 2019

Building visual studio solutions on Jenkins


These are instructions on how to set up and use the MSBuild plugin for jenkins.

Adding MSBuild settings


  1. Go to the jenkins Global Tool Configuration and scroll to find the MSBuild section.
  2. Click "MSBuild Installations..." then "Add MSBuild", now you should see 3 fields to fill in.
  3. Name: Your identifier for these settings, this can be whatever you like but I suggest describing the settings e.g. "vs2019 Release settings"
  4. Path to MSBuild: The path to the Visual Studio compiler.
    Gotcha: In my experience to use the visual studio 2015 compiler I had to include the compiler in the path otherwise the plugin complains about not finding the compiler. Jenkins shows a warning when you do this but it works.
    • For Visual Studio 2015 use MSBuild 14 at:
      C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
    • For Visual Studio 2017 use MSBuild 15 at:
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
    • For Visual Studio 2019 use MSBuild 16 at:
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
  5. Default parameters: Write here what parameters you wish to give the compiler.
    e.g.:
    -t:Clean,Build -p:Configuration="Release" -p:Platform="x64"
    MSBuild 16 uses hyphens for parameters but MSBuild 14 and 15 use a forward slash instead "/t:Clean,Build /p:Configuration="Release" /p:Platform="x64""
    If you're unsure open a command prompt and run MSBuild.exe --help or MSBuild.exe /help
  6. Click Save


Adding MSBuild to a job


  1. Go to the job configuration and scroll to find the Build section 
  2. Click Add build step and choose "Build a Visual Studio project or solution using MSBuild"
  3. In the MSBuild Version list select the setting you saved earlier.
  4. In the MSBuild Build File enter the path for the solution
    e.g. "
    $WORKSPACE\Builds\VisualStudio2019\MyProject.sln"
    (Conviently, you can use the jenkins environment variables here)
  5. Optional Additional parameters may be added to Command Line Arguments text box.
  6. Click Save



  Azure Trusted Signing Signtool Error SignTool Error: An unexpected internal error has occurred. Error information: "Error: SignerSign...