libGit2Sharp “buddy build” leads to error when trying to access TFS


When trying to use the Microsoft.TeamFoundation.Build.Activities.Git library I got the error

The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


The detailed error message said it was looking for version of libGit2Sharp.dll. I noticed that through Nuget I had installed I uninstalled it and reinstalled the proper version using Nuget. However the error persisted. 

Given that this should work under TFS since it is used by the build system, I looked for, and found the version installed by TFS (at C:\Program Files\Microsoft Team Foundation Server 12.0\Tools).  By using ILSpy I discovered that although it has the same version ID (, it is in fact different as it has a newer dependency on file git2-msvstfs.dll.

Apparently Microsoft had a “buddy build” of libGit2Sharp.dll added to TFS 2013 with the same version number, instead of using the official download at I later found out what the differences are, and will report that in another post.


When doing operations against TFS repos you should use the version of libGit2Sharp.dll shipped with TFS (installed under C:\Program Files\Microsoft Team Foundation Server 12.0\Tools), as Microsoft did private changes but did not change the version number.

Comments are closed


<<  February 2024  >>

View posts in large calendar

Month List