From d00b4e3316db52ea34f5f30923e9139e79d76ac0 Mon Sep 17 00:00:00 2001 From: ETWen Date: Sat, 13 Jun 2026 22:11:04 +0800 Subject: [PATCH] chore: Single-source version from csproj Add 0.3.1 to STPViewer.csproj and read the assembly version at runtime for the window title, instead of hardcoding it in XAML. Now bumping alone updates the title and the publish-winapp output folder / exe name in one place. Co-Authored-By: Claude Opus 4.8 --- src/STPViewer/MainWindow.xaml | 2 +- src/STPViewer/MainWindow.xaml.cs | 4 ++++ src/STPViewer/STPViewer.csproj | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/STPViewer/MainWindow.xaml b/src/STPViewer/MainWindow.xaml index 51b3809..9ffc036 100644 --- a/src/STPViewer/MainWindow.xaml +++ b/src/STPViewer/MainWindow.xaml @@ -4,7 +4,7 @@ xmlns:h="http://helix-toolkit.org/wpf" xmlns:conv="clr-namespace:STPViewer.Converters" xmlns:vm="clr-namespace:STPViewer.ViewModels" - Title="STPViewer V0.3.1 — STP/STEP 3D 檢視器" + Title="STPViewer — STP/STEP 3D 檢視器" Height="820" Width="1320" WindowStartupLocation="CenterScreen" AllowDrop="True" Drop="Window_Drop" DragOver="Window_DragOver"> diff --git a/src/STPViewer/MainWindow.xaml.cs b/src/STPViewer/MainWindow.xaml.cs index af5e1da..ae92dcd 100644 --- a/src/STPViewer/MainWindow.xaml.cs +++ b/src/STPViewer/MainWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Reflection; using System.Windows; using System.Windows.Input; using STPViewer.Services; @@ -13,6 +14,9 @@ public partial class MainWindow : Window public MainWindow() { InitializeComponent(); + // 版號單一來源 = csproj ;標題執行時讀,避免寫死 + var v = Assembly.GetExecutingAssembly().GetName().Version!; + Title = $"STPViewer V{v.Major}.{v.Minor}.{v.Build} — STP/STEP 3D 檢視器"; DataContext = _vm; _vm.Attach(viewport); _vm.AttachOverlay(gizmoOverlay); diff --git a/src/STPViewer/STPViewer.csproj b/src/STPViewer/STPViewer.csproj index 8cfdffd..1253814 100644 --- a/src/STPViewer/STPViewer.csproj +++ b/src/STPViewer/STPViewer.csproj @@ -6,6 +6,7 @@ enable enable true + 0.3.1