Skip to content

Commit

Permalink
Drop version build metadata for official releases
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Jul 16, 2024
1 parent 3464e65 commit 1b22753
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Bonsai.Core/WorkflowBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,14 @@ void IXmlSerializable.WriteXml(XmlWriter writer)
writer = new XmlExtensionWriter(writer, genericTypes);

var assembly = Assembly.GetExecutingAssembly();
var versionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
writer.WriteAttributeString(VersionAttributeName, versionInfo.ProductVersion);
var version = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;
#if BUILD_KIND_OFFICIAL_RELEASE
// Drop build metadata for official releases
var plus = version.IndexOf('+');
if (plus >= 0)
version = version.Substring(0, plus);
#endif
writer.WriteAttributeString(VersionAttributeName, version);

var namespaceDeclarations = GetXmlSerializerNamespaces(types);
foreach (var qname in namespaceDeclarations)
Expand Down
7 changes: 6 additions & 1 deletion Bonsai.Editor/AboutBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ public string AssemblyVersion
{
get
{
return FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;
var productVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;
#if BUILD_KIND_OFFICIAL_RELEASE
return SemanticVersion.Parse(productVersion).ToString();
#else
return productVersion;
#endif
}
}

Expand Down

0 comments on commit 1b22753

Please sign in to comment.