question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

macOS Build: "The 'Microsoft.Build.Tasks.Git.LocaleteRepository" task failed unexpectedly

See original GitHub issue

Occured when building this repo

Using Visual studio for Mac (Community) 7.6.7 (build 49)

my environment:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.402
 Commit:    3599f217f4

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.402/

Host (useful for support):
  Version: 2.1.4
  Commit:  85255dde3e

.NET Core SDKs installed:
  2.0.0 [/usr/local/share/dotnet/sdk]
  2.1.4 [/usr/local/share/dotnet/sdk]
  2.1.302 [/usr/local/share/dotnet/sdk]
  2.1.402 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

The error:


 The "Microsoft.Build.Tasks.Git.LocateRepository" task failed unexpectedly.
 System.TypeInitializationException: The type initializer for 'Microsoft.Build.Tasks.Git.TaskImplementation' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Tasks.Git.Operations' or one of its dependencies
   at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x001a9] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System/AppDomain.cs:777 
   at (wrapper remoting-invoke-with-check) System.AppDomain.Load(System.Reflection.AssemblyName,System.Security.Policy.Evidence)
   at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System/AppDomain.cs:714 
   at (wrapper remoting-invoke-with-check) System.AppDomain.Load(System.Reflection.AssemblyName)
   at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/Assembly.cs:600 
   at Microsoft.Build.Tasks.Git.TaskImplementation..cctor () [0x0006b] in /_/src/Microsoft.Build.Tasks.Git/TaskImplementation.cs:32 
    --- End of inner exception stack trace ---
   at Microsoft.Build.Tasks.Git.LocateRepository.Execute () [0x0000f] in /_/src/Microsoft.Build.Tasks.Git/LocateRepository.cs:27 
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /_/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:631 
   at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x00212] in /_/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:787 
Done building project "JsonApiDotNetCore.csproj" -- FAILED.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Cheesebaroncommented, Oct 26, 2018

This is also happening when trying to build MvvmCross on macOS although the stack trace seems to be a bit different:

The "Microsoft.Build.Tasks.Git.LocateRepository" task failed unexpectedly.
System.BadImageFormatException: Method has no body
File name: 'LibGit2Sharp'
  at LibGit2Sharp.Core.Proxy.git_buf_free (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <06ab184b4ccd4259a7a7af2756f77645>:0 
  at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <06ab184b4ccd4259a7a7af2756f77645>:0 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <06ab184b4ccd4259a7a7af2756f77645>:0 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x00005] in <06ab184b4ccd4259a7a7af2756f77645>:0 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <06ab184b4ccd4259a7a7af2756f77645>:0 
  at Microsoft.Build.Tasks.Git.GitOperations.LocateRepository (System.String directory) [0x00000] in /_/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs:24 
  at Microsoft.Build.Tasks.Git.RepositoryTasks.LocateRepository (Microsoft.Build.Tasks.Git.LocateRepository task) [0x00000] in /_/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs:50 
  at Microsoft.Build.Tasks.Git.LocateRepository.Execute () [0x00038] in /_/src/Microsoft.Build.Tasks.Git/LocateRepository.cs:32 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784 
0reactions
tmatcommented, Jan 7, 2019

If you’re building on Mono that’s a different issue: https://github.com/dotnet/sourcelink/issues/155

Read more comments on GitHub >

github_iconTop Results From Across the Web

IdentityServer4: "Microsoft.Build.Tasks.Git. ...
I have cleaned the solution and build it. I am getting "Microsoft.Build.Tasks.Git.LocateRepository" task failed unexpectedly build error.
Read more >
Custom Buld Task when used in csproject, throws 'Caould ...
When I build (Project B), it throws error in Visual Studio : MSB4018 "The "SimpleTask" task failed unexpectedly".
Read more >
Error MSB4018: The "ResolvePackageAssets" task failed ...
Suddenly, building on Visual Studio for Mac 8.3.11 (build 1) on MacOS 10.12 is giving me this error. Please help me me resolve...
Read more >
ResolvePackageAssets task failed
This issue is currently being investigated. The problem is that Mono's MSBuild does not currently support NuGet 5 so you cannot use .NET...
Read more >
How to fix "WriteCodeFragment" error when build .net core
Sdk/targets/Microsoft.NET.GenerateAssemblyInfo.targets(5,5): Error MSB4018: The "WriteCodeFragment" task failed unexpectedly. System.IO.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found