Skip to content

Commit 9eb6538

Browse files
committed
Use Nerdbank.GitVersioning
1 parent cbb2cc8 commit 9eb6538

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

CommonMark.Console/CommonMark.Console.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<Description>https://github.com/Knagis/CommonMark.NET</Description>
1616
<Copyright>Copyright © Kārlis Gaņģis 2014</Copyright>
1717

18-
<Version>1.0.0.0</Version>
19-
<FileVersion>1.0.0.0</FileVersion>
20-
2118
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2219
<NuspecFile>..\CommonMark.NET.Console.nuspec</NuspecFile>
2320
<NuspecProperties>configuration=$(Configuration)</NuspecProperties>
@@ -41,6 +38,10 @@
4138
<DebugType>pdbonly</DebugType>
4239
</PropertyGroup>
4340

41+
<ItemGroup>
42+
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
43+
</ItemGroup>
44+
4445
<ItemGroup>
4546
<ProjectReference Include="..\CommonMark\CommonMark.Base.csproj" />
4647
</ItemGroup>

CommonMark/CommonMark.Base.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
<Description>https://github.com/Knagis/CommonMark.NET</Description>
2020
<Copyright>Copyright © Kārlis Gaņģis 2014-2016</Copyright>
2121

22-
<Version>0.1.0.0</Version>
23-
<FileVersion>0.1.0.0</FileVersion>
24-
2522
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2623
<NuspecFile>..\CommonMark.NET.nuspec</NuspecFile>
2724
<NuspecProperties>configuration=$(Configuration)</NuspecProperties>
@@ -68,6 +65,10 @@
6865
</When>
6966
</Choose>
7067

68+
<ItemGroup>
69+
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
70+
</ItemGroup>
71+
7172
<ItemGroup>
7273
<EmbeddedResource Include="..\CommonMark.NET.nuspec">
7374
<Link>Properties\CommonMark.NET.nuspec</Link>

CommonMark/CommonMarkConverter.cs

+1-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System;
44
using System.IO;
55
using System.Reflection;
6-
using System.Text;
76
using System.Threading;
87

98
namespace CommonMark
@@ -46,22 +45,7 @@ public static Version Version
4645

4746
private static Version InitializeVersion()
4847
{
49-
// System.Xml is not available so resort to string parsing.
50-
using (var stream = Assembly.GetManifestResourceStream("CommonMark.Properties.CommonMark.NET.nuspec"))
51-
using (var reader = new System.IO.StreamReader(stream, Encoding.UTF8))
52-
{
53-
string line;
54-
while ((line = reader.ReadLine()) != null)
55-
{
56-
var i = line.IndexOf("<version>", StringComparison.Ordinal);
57-
if (i == -1)
58-
continue;
59-
60-
i += 9;
61-
return new Version(line.Substring(i, line.IndexOf("</version>", StringComparison.Ordinal) - i));
62-
}
63-
}
64-
return null;
48+
return new Version(ThisAssembly.AssemblyFileVersion);
6549
}
6650

6751
/// <summary>

version.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3+
"version": "0.15.1.0",
4+
"assemblyVersion": {
5+
"precision": "minor"
6+
},
7+
"publicReleaseRefSpec": [
8+
"^refs/heads/master$"
9+
],
10+
"nugetPackageVersion": {
11+
"semVer": 1
12+
},
13+
"cloudBuild": {
14+
"buildNumber": {
15+
"enabled": true
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)