chore: Single-source version from csproj <Version>

Add <Version>0.3.1</Version> to STPViewer.csproj and read the assembly
version at runtime for the window title, instead of hardcoding it in
XAML. Now bumping <Version> alone updates the title and the
publish-winapp output folder / exe name in one place.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-13 22:11:04 +08:00
co-authored by Claude Opus 4.8
parent ac08c129bd
commit d00b4e3316
3 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -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">
+4
View File
@@ -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 <Version>;標題執行時讀,避免寫死
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);
+1
View File
@@ -6,6 +6,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<Version>0.3.1</Version> <!-- 單一版號來源:標題與 publish-winapp 打包資料夾都讀這個 -->
</PropertyGroup>
<ItemGroup>