Skip to content

Commit

Permalink
Strip revision from assembly version
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Aug 6, 2024
1 parent 6d7b14b commit 56dd06b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions TwitchDownloaderWPF/Extensions/VersionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace TwitchDownloaderWPF.Extensions
{
public static class VersionExtensions
{
public static Version StripRevisionIfDefault(this Version version) => version.Revision < 1 ? new Version(version.Major, version.Minor, version.Build) : version;
}
}
3 changes: 2 additions & 1 deletion TwitchDownloaderWPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)
// it will sometimes start behind other windows, usually (but not always) due to the user's actions.
FlashTaskbarIconIfNotForeground(TimeSpan.FromSeconds(3));

var currentVersion = Assembly.GetExecutingAssembly().GetName().Version!;
// Despite not specifying a revision in the AssemblyVersion, the compiler still adds one. We don't want that.
var currentVersion = Assembly.GetExecutingAssembly().GetName().Version!.StripRevisionIfDefault();
#if DEBUG
Title = $"Twitch Downloader v{currentVersion} - DEBUG";
#else
Expand Down

0 comments on commit 56dd06b

Please sign in to comment.