Skip to content

Publish as .NET Core Global Tool #1464

Closed

Description

@kll

I think it would be a good idea to publish GitVersion as a .NET Core Global Tool.

I'm willing to do the work if it is agreed upon that it is a good idea. I haven't looked into it in detail yet but I assume it would probably need some outstanding work like #1445 and #1422 to get wrapped up first. It would obviously require getting actual stable releases out to nuget.org again. 😄

First order of business would be picking the name of the package. I'm personally pretty confused on what all the various GitVersion related packages already on nuget.org are for so I think some care to pick a good meaningful is important. I like what Cake did in v0.30.0 and suggest GitVersion.Tool for the package name. It's not taken but there is an existing GitVersion.Tools which might be confusing.

The end result would be easily installing GitVersion on any platform that supports .NET core with the following command:

dotnet tool install -g GitVersion.Tool

Then you can run it from anywhere with this command:

dotnet gitversion

Activity

  1. arturcic commented on Aug 30, 2018

    @arturcic
    Member

    What about naming the package as GitVersion.CommandLine.Tool or GitVersion.CommandLine.DotNetCore.Tool

  2. arodus commented on Aug 31, 2018

    @arodus

    @kll

    Then you can run it from anywhere with this command:
    dotnet gitversion

    The command would be just gitversion without the dotnet.

  3. dazinator commented on Sep 6, 2018

    @dazinator
    Contributor

    @arodus

    The command would be just gitversion without the dotnet.

    According to https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools it could be run either way depending on how it's written!

    I'd favour dotnet gitversion just because chocolatey package already puts gitversion on the PATH so it might get a bit confusing if people are running gitversion as to which one is being used (chocolatey versus global tool) - where as dotnet gitversion makes it obvious.

    @arturcic - this would definitely be a welcomed PR but you are right those issues you linked are high on the agenda right now for obvious reasons

  4. kll commented on Sep 25, 2018

    @kll
    ContributorAuthor

    This is now part of #1422. Try it out with:
    dotnet tool install -g --version 4.0.0-pullrequest1422-1625 --add-source https://ci.appveyor.com/nuget/gitversion-8nigugxjftrw GitVersion.CommandLine.DotNetCore.Tool

    My personal preference for the tool Package Id to be something shorter and easier to remember though. :) Not a big deal because the end result once it's installed of dotnet gitversion is the exact same and that is easy enough to remember. :)

  5. kll commented on Sep 26, 2018

    @kll
    ContributorAuthor

    This works for me in Windows but not in Linux (Debian 9). It's the same LibGit2Sharp error I've seen before. I'll try to debug it but I'm a bit out of my depth.

    System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'git2-b0d9952' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-b0d9952: cannot open shared object file: No such file or directory
       at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
       at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
       at LibGit2Sharp.Core.NativeMethods..cctor()
       --- End of inner exception stack trace ---
       at LibGit2Sharp.Core.NativeMethods.git_buf_free(GitBuf buf)
       at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever)
       at LibGit2Sharp.Repository.Discover(String startingPath)
       at GitVersion.GitPreparer.GetDotGitDirectory() in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 163
       at GitVersion.GitPreparer.GetProjectRootDirectory() in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 177
       at GitVersion.ConfigurationProvider.Verify(GitPreparer gitPreparer, IFileSystem fileSystem) in C:\projects\gitversion\src\GitVersionCore\Configuration\ConfigurationProvider.cs:line 268
       at GitVersion.Program.VerifyArgumentsAndRun()
    
  6. arturcic commented on Sep 26, 2018

    @arturcic
    Member

    please have a look here #1473

  7. kll commented on Sep 26, 2018

    @kll
    ContributorAuthor

    Well it actually worked fine for me with the official Debian 9 based dotnet:2.1-sdk Docker image. It was failing for me in a newly set up Debian 9 VM. After debugging things it turns out it was actually finding the libgit2-b0d9952.so correctly but that library needs libcurl.so.4 which was not present. I installed it by running sudo apt-get install libcurl3 and it started working.

    Unrelated to the error but while I was poking around debugging it I noticed some extra stuff in the package.
    content/GemAssets and contentFiles/any/netcoreapp2.1/GemAssets/.gitignore which I assume has something to do with the ruby gem and probably doesn't need to be included with the dotnet tool.

  8. TangoMikeOscar commented on Oct 25, 2018

    @TangoMikeOscar

    Hi just to voice my support for this, we are changing our build process over to be fully dotnet core compatible so we can build on linux and gitversion is our final hurdle with downloading tools via the dotnet tool install command line.

    In regards to naming we currently use FAKE and Octopus Deploy Tools which have the package naming fake-cli and Octopus.DotNet.Cli respectively, so maybe something like GitVersion.DotNetCore.Cli is the way to go?

  9. arturcic commented on Nov 11, 2018

    @arturcic
    Member

    Closed by #1528

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions