| Jenkins – Build Configuration |


Configure Jenkins to build a project on demand, or whenever code is pushed to TFS, and archive (save) the artifacts (output).


This article is from a .NET development perspective – using a full Microsoft stack.  The Jenkins installation is for Windows Server, builds are done with MSBuild, and the source control is TFS.


 Previous Article  (installed and setup Jenkins server)

Conditional Configuration

If you are using TFS Online (instead of an on-premise TFS), as I am, then you will need these extra configuration steps before beginning. TFS Online requires “Alternate Credentials” enabled, so that Jenkins is be able to authenticate and connect.

Otherwise, you will get a 401 Unauthorized error during builds.

1) Profile
2) Security

1) Alternate authentication credentials
2) Enable
3) Username: {yourAlternateUserName}
     Password: {yourPassword}
     Confirm Password: {yourPassword}
4) Save

Build Configuration

Creating a folder

1) New Item
2) Create new jobs
*** #1 and #2 do the same thing ***

1) Item name: {folderName}
2) Folder
3) Ok

1) Name: {folderName}
    Display Name: {displayName}
    Description: {describeFolderContents}
2) Save

Creating the build job

1) New Item
2) Create new jobs
*** #1 and #2 do the same thing ***

1) Freestyle project
2) Item name: {jobName}
3) Ok

Plugging into TFS

1) Team Foundation Version Control (TFVC)
2) Collection URL: {yourTFSCollectionURL}
3) Project Path: $/{yourProjectPath}
4) Credentials: Manual
5) User name: {yourUsername}
6) User password: {yourPassword}

Adding build steps

1) Build when a change is pushed to TFS/Team Services
2) Add Timestamps to the Console Output
3) MSBuild Version (dropdown)
4) MSBuild Build File (.sln or custom .proj)

1) Files to archive:
  •     To archive everything use **
  •     To archive just the compiled output use */*/bin/**
2) Save

Executing the build

1) Build Now – manually triggers the build
2) Build scheduled

Building – displaying progress

Retrieving the artifacts

Completed – clicking the build number goes to that build’s summary/information page

1) Build Artifacts – takes you to the detailed artifact screen
2) Console Output – full output (useful for getting error details)
3) Artifact files preview

1) Artifact top folder
2) All files in zip
3) Downloaded zip

Local storage locations

1) C:\Program Files (x86)\Jenkins

1) C:\Program Files (x86)\Jenkins\jobs\{folderName}\jobs\{jobName}\builds
2) Build number


We now have our Jenkins job configured to build anytime code is pushed to TFS, or if manually triggered. The project is beginning to follow Agile methodologies with Continuous Integration.

Next steps – continue developing the build pipeline for automatic deploys.