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.
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).
@kll can you have a look?
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.
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
@LordMike can you try the new build 4.0.1-beta1-55?
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]
If 459bf462ee898511f619d3c5575ff4f9ef89ff67 managed to reduce the error to a warning, is this not a blocker anymore so we can continue as planned in https://github.com/GitTools/GitVersion/pull/1422#issuecomment-449349025?
@LordMike, @arturcic: What say ye? 鈽濓笍
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.
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?
I was able to reproduce it locally, have create a sample console app with the GitVersionTask nuget package installed. I was able to fix it by partially reverting the commit related to .net standard 2.0 support. The 2.0 remains in place, the GitTools.Core is not included by source but using the nuget package, the old way. I'll try to fix GitTool.Core in it's repo, and then updated it in GitVersion. For now we'll use the older version of GitTools.Core
@adamshergold can you test the version 4.0.1-beta1-59? I guess @LordMike will not be able to test it.
Hi @arturcic ... i've tried with beta1-59 and it's okay IF I install libgit2-dev in the dotnet-sdk container before starting the build. I do this as part of my gitlab build steps:
apt-get update
apt-get install -y libgit2-dev
ln -s /usr/lib/x86_64-linux-gnu/libgit2.so /lib/x86_64-linux-gnu/libgit2-15e1193.so
If I don't do this then I get errors like this:
MSBUILD : warning : WARN [01/24/19 10:57:21:20] 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 [/builds/adamshergold/example.types/example.types.schema/example.types.schema.fsproj]
MSBUILD : warning : at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() [/builds/adamshergold/example.types/example.types.schema/example.types.schema.fsproj]
MSBUILD : warning : at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary() [/builds/adamshergold/example.types/example.types.schema/example.types.schema.fsproj]
MSBUILD : warning : at LibGit2Sharp.Core.NativeMethods..cctor() [/builds/adamshergold/example.types/example.types.schema/example.types.schema.fsproj]
Happy to give you access to my gitlab build if you want to look further and/or am very happy to help out with further investigation.
thanks!
That is expected, as I had to revert to older version of GitTools.Core nuget package that was using the old LibGit2Sharp. So it should work exactly the same as beta1-51, the one before the merge of #1422. I will try to update the GitTools.Core nuget package with the latest and then use it in GitVersion, hope we will not need to do the workaround
So it is basically GitVersion on netstandard 2.0 using LibGit2Sharp version netstandard 1.3 I guess
Sounds good. I'll stick with beta1-59 and the libgit2-dev install for the time-being.
suggested solution with manual install doesn't work on alpine images
@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.
any updates on this?
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]
@adamshergold , @bonesoul can you try the latest version?
As LibGit2Sharp was upgraded to version 0.26 in #1713, I think this problem is fixed. Please reopen this issue if the problem persists.
@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
@sandorfr , do you mind giving a try to this one? https://marketplace.visualstudio.com/items?itemName=gittools.gitversion-preview
@arturcic it was the was I tried for I actually switch to the normal one with 5.0 and it works.