Skip to content

4.0.1-beta1-53: Fails to find the LibGit2Sharp. #1550

Closed

Description

@LordMike

This compiled before lunch :P

> dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 24,17 ms for C:\Src\Project.csproj.
[NuGet Minimal]: Restoring packages for C:\Users\MichaelBisbjerg\.nuget\packages\gitversiontask\4.0.1-beta1-53\build\functionality\GitVersionBuild.targets...
[NuGet Minimal]: Restoring packages for C:\Users\MichaelBisbjerg\.nuget\packages\gitversiontask\4.0.1-beta1-53\build\functionality\GitVersionBuild.targets...
MSBUILD : warning : WARN [12/13/18 13:00:50:51] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Src\Project.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Src\Project.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Src\Project.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Src\Project.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Src\Project.csproj]
MSBUILD : warning :  [C:\Src\Project.csproj]
MSBUILD : warning :  [C:\Src\Project.csproj]
MSBUILD : warning : WARN [12/13/18 13:00:50:54] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Src\Project.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Src\Project.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Src\Project.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Src\Project.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Src\Project.csproj]
MSBUILD : warning :  [C:\Src\Project.csproj]
MSBUILD : warning :  [C:\Src\Project.csproj]
MSBUILD : warning : WARN [12/13/18 13:00:50:57] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Src\Project.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Src\Project.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Src\Project.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Src\Project.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Src\Project.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Src\Project.csproj]
MSBUILD : warning :  [C:\Src\Project.csproj]
MSBUILD : warning :  [C:\Src\Project.csproj]
C:\Program Files\dotnet\sdk\2.1.500\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets(161,5): error MSB4044: The "GetAssemblyVersion" task was not given a value for the required parameter "NuGetVersion". [C:\Src\Project.csproj]

Build FAILED.

Activity

  1. adamshergold commented on Dec 13, 2018

    @adamshergold

    Same for me! I picked up beta-53 and get same issue. Have explicitly fixed dependency to be on beta-51 for the moment (which works).

  2. arturcic commented on Dec 14, 2018

    @arturcic
    Member

    @kll can you have a look?

  3. kll commented on Dec 14, 2018

    @kll
    Contributor

    Unfortunately I'm under a pretty big time crunch at work and don't have the time to look at other stuff. I also don't really use or understand how GitVersionTask works so I don't have much to go on. Just based on the error message though I followed a hunch and downloaded the gitversiontask-4.0.1-beta1-53.nupkg file and decompressed it to look at the files. The build/net461 directory contains LibGit2Sharp.dll and the lib folder with the native bits but the build/netstandard2.0 folder does not. So I assume it's just a packaging issue. I tried to glance through the project and build scripts and couldn't immediately understand how that package is produced to include the files directly rather than as nuget references like in the other projects that produce nuget packages.

    That's all the time I can spend on it for now but hopefully it points someone more knowledgeable than I in the right direction.

  4. arturcic commented on Dec 14, 2018

    @arturcic
    Member

    Thanks, yes that's a good start, I'll try to find some time and check why it's not adding to the netstandard2.0

  5. self-assigned this
    on Dec 21, 2018
  6. added a commit that references this issue on Dec 21, 2018
  7. added this to the 5.0.0 milestone on Dec 21, 2018
  8. arturcic commented on Dec 21, 2018

    @arturcic
    Member

    @LordMike can you try the new build 4.0.1-beta1-55?

  9. LordMike commented on Dec 22, 2018

    @LordMike
    Author

    I now get this. While it's just a Warning, the build fails for completely different reasons - Jetbrains attributes are missing.. It still does build in 4.0.1-beta1-51, fails as before in -53 , and fails like below in -55.

    MSBUILD : warning : WARN [12/22/18 4:11:12:00] Could not determine assembly version: System.Runtime.InteropServices.MarshalDirectiveException: StrictFilePathMarshaler must be used on a FilePath. [C:\Project\Project.csproj]
    MSBUILD : warning :    at LibGit2Sharp.Core.StrictFilePathMarshaler.MarshalManagedToNative(Object managedObj) in C:\projects\libgit2sharp\LibGit2Sharp\Core\FilePathMarshaler.cs:line 71 [C:\Project\Project.csproj]
    MSBUILD : warning :    at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) [C:\Project\Project.csproj]
    MSBUILD : warning :    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs) [C:\Project\Project.csproj]
    MSBUILD : warning :    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 3553 [C:\Project\Project.csproj]
    MSBUILD : warning :    at LibGit2Sharp.Repository.Discover(String startingPath) in C:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 645 [C:\Project\Project.csproj]
    MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 163 [C:\Project\Project.csproj]
    MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Project\Project.csproj]
    MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Project\Project.csproj]
    
  10. asbjornu commented on Jan 17, 2019

    @asbjornu
    Member

    If 459bf46 managed to reduce the error to a warning, is this not a blocker anymore so we can continue as planned in #1422 (comment)?

  11. asbjornu commented on Jan 21, 2019

    @asbjornu
    Member

    @LordMike, @arturcic: What say ye? ☝️

  12. arturcic commented on Jan 21, 2019

    @arturcic
    Member

    To be honest I would prefer to test it myself, just need a sample how to do that, so that next time I can confirm if it's working, @LordMike could you provide a sample of the project that has the GitVersion Task configured, as I prefer using the global tool instead of msbuild.

  13. LordMike commented on Jan 21, 2019

    @LordMike
    Author

    We no longer use the task. It had some other rather horrendous implications, such as being very slow for multiple projects and not supporting parallel operations. As of this comment we moved to an entirely build-script managed approach, where the scripe (Nuke) handles the Gitversion CLI and does magic.

    So, right now, I won't be able to contribute a working (failing) example. Although, it shouldn't be hard to reproduce?

  14. added a commit that references this issue on Jan 23, 2019
  15. 7 remaining items

  16. twsl commented on Feb 5, 2019

    @twsl

    suggested solution with manual install doesn't work on alpine images

  17. Svetomechc commented on Mar 4, 2019

    @Svetomechc

    @twsi use builds with two stages. The first one would rely on microsoft/dotnet:dotnet:2.2-sdk, the second one would be microsoft/dotnet:2.2-aspnetcore-runtime-alpine. This is the most painless solution I've found so far, with resulting image size being okay-ish.

  18. bonesoul commented on Apr 16, 2019

    @bonesoul

    any updates on this?

  19. arturcic commented on Apr 18, 2019

    @arturcic
    Member
  20. bonesoul commented on May 8, 2019

    @bonesoul

    i'm using 5.0.0-beta2-75 on an ubuntu 14.04 build with libcurl3 installed but still getting

    MSBUILD : warning : WARN [05/08/19 12:26:01:82] Could not determine assembly version: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'git2-15e1193' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-15e1193: cannot open shared object file: No such file or directory [/temp/src/hypeengine.twitch/hypeengine.twitch.csproj]

  21. arturcic commented on Jun 27, 2019

    @arturcic
    Member

    @adamshergold , @bonesoul can you try the latest version?

  22. asbjornu commented on Jun 27, 2019

    @asbjornu
    Member

    As LibGit2Sharp was upgraded to version 0.26 in #1713, I think this problem is fixed. Please reopen this issue if the problem persists.

  23. sandorfr commented on Jul 25, 2019

    @sandorfr

    @asbjornu looks like it's still happening with the vsts extension on Mac agents:

    
    ERROR [07/25/19 10:47:38:08] An unexpected error occurred: |  
    -- | --
      | System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-15e1193 |  
      | at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods.git_libgit2_init() |  
      | at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary () [0x00000] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at LibGit2Sharp.Core.NativeMethods..cctor () [0x00054] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | --- End of inner exception stack trace --- |  
      | at LibGit2Sharp.Core.Proxy.git_buf_free (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x00005] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at GitVersion.GitPreparer.GetProjectRootDirectory () [0x00048] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at GitVersion.ConfigurationProvider.Verify (GitVersion.GitPreparer gitPreparer, GitVersion.Helpers.IFileSystem fileSystem) [0x00014] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at GitVersion.Program.VerifyConfiguration (GitVersion.Arguments arguments, GitVersion.Helpers.IFileSystem fileSystem) [0x00023] in <824ee26b2afa49d5948582decd2171d3>:0 |  
      | at GitVersion.Program.VerifyArgumentsAndRun () [0x00118] in <824ee26b2afa49d5948582decd2171d3>:0
    
  24. sandorfr commented on Jul 25, 2019

    @sandorfr

    @arturcic it was the was I tried for I actually switch to the normal one with 5.0 and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions