mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
- Remove obsolete sample targets - Restore and build solution (.Lean) instead of projects - Read version from common.props, compare with latest changelog version and fail if not equal - Keep PostFix separate from version (AssemblyVersion may not have a postfix), so the postfix will go into the package version and file name as well as the informational version (visible in file properties dialog on Windows) - Add "ElectronNET.Core " as prefix to GitHub release names (to disambiguate with earlier versions)
33 lines
800 B
C#
33 lines
800 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Xml.Linq;
|
|
|
|
/// <summary>
|
|
/// Parses a version from an MSBuild .props file (XML).
|
|
/// </summary>
|
|
public sealed class CommonPropsParser
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ReleaseNotesParser"/> class.
|
|
/// </summary>
|
|
public CommonPropsParser()
|
|
{
|
|
}
|
|
|
|
public Version Parse(string propsPath)
|
|
{
|
|
var doc = XDocument.Load(propsPath);
|
|
|
|
var versionElement = doc
|
|
.Descendants()
|
|
.FirstOrDefault(e => e.Name.LocalName == "Version");
|
|
|
|
if (Version.TryParse(versionElement?.Value.Trim(), out var version))
|
|
{
|
|
version = new Version(version.Major, version.Minor, version.Build);
|
|
return version;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
} |