Skip to content

Commit

Permalink
GitVersion
Browse files Browse the repository at this point in the history
- Use GitVersion to stamp version numbers into assemblies.

https://github.com/GitTools/GitVersion

Use GitVersioning variables to set NuGet package version properties.

Use Mainline versioning policy in GitVersion v4.0+.

- Bump next version to 1.2.x for easier reference.

Only run `GitVersionTask` during Windows builds.

Failure more on Linux:
```
2018-12-04T18:02:22.6601166Z "/home/vsts/work/1/s/ServerHost.sln" (default target) (1) ->
2018-12-04T18:02:22.6601998Z "/home/vsts/work/1/s/ServerHost/ServerHost.csproj" (default target) (2) ->
2018-12-04T18:02:22.6602670Z (WriteVersionInfoToBuildLog target) ->
2018-12-04T18:02:22.6604817Z   /home/vsts/.nuget/packages/gitversiontask/4.0.1-beta1-50/build/functionality/GitVersionBuild.targets(6,5):
 error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded
   from the assembly "/home/vsts/.nuget/packages/utilpack.nuget.msbuild/2.9.1/build/net46/UtilPack.NuGet.MSBuild.dll".
 Could not load type of field 'UtilPack.NuGet.BoundRestoreCommandUser:_clientPolicyContext' (8) due to:
 Could not resolve type with token 0100006c from typeref (expected class 'NuGet.Packaging.Signing.ClientPolicyContext' in assembly 'NuGet.Packaging, Version=4.9.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35')
 assembly:NuGet.Packaging, Version=4.9.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 type:NuGet.Packaging.Signing.ClientPolicyContext
 member:(null)
 [/home/vsts/work/1/s/ServerHost/ServerHost.csproj]
```
  • Loading branch information
jthelin committed Sep 29, 2019
1 parent ca3749f commit fff8180
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
assembly-versioning-scheme: Major
mode: Mainline
increment: Patch
next-version: 1.2.0
branches:
master:
tag: alpha
prevent-increment-of-merged-branch-version: true
1 change: 1 addition & 0 deletions ServerHost.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{64DBC33D
Build.cmd = Build.cmd
Build.sh = Build.sh
Clean.cmd = Clean.cmd
GitVersion.yml = GitVersion.yml
nuget-restore.cmd = nuget-restore.cmd
Test.cmd = Test.cmd
Test.runsettings = Test.runsettings
Expand Down
10 changes: 8 additions & 2 deletions ServerHost/ServerHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.1.18</Version>
<Version>$(NuGetVersion)</Version>
<Authors>Jorgen Thelin</Authors>
<Copyright>Copyright © Jorgen Thelin 2015-2018</Copyright>
<Description>ServerHost - A .NET Server Hosting utility library, including in-process server host testing.</Description>
Expand All @@ -21,7 +21,7 @@
<PackageTags>DotNet Server Host Testing AppDomain</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/jthelin/ServerHost.git</RepositoryUrl>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<AssemblyVersion>$(AssemblySemVer)</AssemblyVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TRAVIS)' == 'true' OR '$(OS)' != 'Windows_NT'">
Expand Down Expand Up @@ -51,6 +51,12 @@
<PackageReference Include="log4net" Version="2.0.8" />
</ItemGroup>

<ItemGroup Condition=" '$(OS)' == 'Windows_NT' ">
<PackageReference Include="GitVersionTask" Version="4.0.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit fff8180

Please sign in to comment.