Skip to content

Commit 3f924d3

Browse files
committed
Use Nerdbank.GitVersioning
1 parent cbb2cc8 commit 3f924d3

File tree

4 files changed

+22
-30
lines changed

4 files changed

+22
-30
lines changed

CommonMark.Console/CommonMark.Console.csproj

+2-7
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>
@@ -42,13 +39,11 @@
4239
</PropertyGroup>
4340

4441
<ItemGroup>
45-
<ProjectReference Include="..\CommonMark\CommonMark.Base.csproj" />
42+
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
4643
</ItemGroup>
4744

4845
<ItemGroup>
49-
<EmbeddedResource Include="..\CommonMark.NET.Console.nuspec">
50-
<Link>Properties\CommonMark.NET.Console.nuspec</Link>
51-
</EmbeddedResource>
46+
<ProjectReference Include="..\CommonMark\CommonMark.Base.csproj" />
5247
</ItemGroup>
5348

5449
</Project>

CommonMark/CommonMark.Base.csproj

+1-6
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>
@@ -69,9 +66,7 @@
6966
</Choose>
7067

7168
<ItemGroup>
72-
<EmbeddedResource Include="..\CommonMark.NET.nuspec">
73-
<Link>Properties\CommonMark.NET.nuspec</Link>
74-
</EmbeddedResource>
69+
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
7570
</ItemGroup>
7671

7772
</Project>

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)