Skip to content

Easier linux build guide #1882

Closed
Closed
@xposure

Description

@xposure

If you remove this from GitVersionExe.csproj

    <PropertyGroup Condition=" '$(PackAsTool)' != 'true'">
        <TargetFrameworks>net472;$(TargetFrameworks);</TargetFrameworks>
    </PropertyGroup>

    <PropertyGroup Condition=" '$(PackAsTool)' == 'true' ">
        <ToolCommandName>dotnet-gitversion</ToolCommandName>
        <PackageId>GitVersion.Tool</PackageId>
        <PackageDescription>Derives SemVer information from a repository following GitFlow or GitHubFlow. This is the .NET Core Global Tool allowing usage of GitVersion from command line.</PackageDescription>
    </PropertyGroup>

    <ItemGroup Condition="'$(TargetFramework)'=='net472'">
        <PackageReference Include="JetBrains.Annotations" Version="$(PackageVersion_JetBrainsAnnotations)"></PackageReference>
        <PackageReference Include="LibGit2Sharp.NativeBinaries" Version="$(PackageVersion_LibGit2Sharp_NativeBinaries)" />
    </ItemGroup>

You can then simply go to src/GitVersionExe folder and run dotnet publish -c Release -r linux-x64 --framework netcoreapp3.0 /p:PublishSingleFile=true which will produce a single executable in bin/Release/netcoreapp3.0/ubuntu-x64/publish/ that you can then easily use.

The documentation at https://gitversion.readthedocs.io/en/latest/usage/command-line/ lead me down a long winding path of curse words and head aches and in the end it still didn't work. So I decided to just check out the code and see if I could simply build it from source and in a matter of minutes it worked...

This is of course after following these steps to get dotnet core sdk3:
https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current

This issue is closed and notes about eventually being able to just use .net core #1229 that issue then relates to this PR #1269 which is now merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions