title: TFS 2013 Throws Lib2GitSharp Error During Build/Deploy (Intermittent)
body: <p>For a while now, I have been having an issue with Team Foundation Server build/deploy process throwing the following error intermittently:</p>
  
  <pre><code>Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---&gt; System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
  at LibGit2Sharp.Core.NativeMethods.git_threads_init()
  at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
  at LibGit2Sharp.Core.NativeMethods..cctor()
  --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods.RemoveHandle()
  at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()
  Exception Message: MSBuild error 255 has ended this build. You can find more     specific information about the cause of this error in above messages. (type   BuildProcessTerminateException) Exception Stack Trace: at     System.Activities.Statements.Throw.Execute(CodeActivityContext context) at     System.Activities.CodeActivity.InternalExecute(ActivityInstance instance,     ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
  </code></pre>
  
  <p>This problem is very intermittent and it can be bypassed by simply retrying the build. Has anyone else run into this? Any solutions?</p>