From ef83c88083909b089e215e5b2365cee8f40febae Mon Sep 17 00:00:00 2001 From: poli0981 <127664709+poli0981@users.noreply.github.com> Date: Fri, 19 Jun 2026 13:58:54 +0700 Subject: [PATCH] build: add assembly metadata + Velopack --packAuthors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Đợt 1 of the post-v1.0 line (metadata + packaging). - Directory.Build.props: inheritable package/assembly metadata (Product, Authors/Company=poli0981, Copyright, Description, RepositoryUrl/PackageProjectUrl, default Version 1.0.0). AssemblyVersion is intentionally NOT pinned so it follows Version (stamped from the git tag at publish), keeping the in-app About / Report-Bug version accurate. - scripts/pack.ps1: pass --packTitle / --packAuthors to vpk pack (correct plural flag) and -p:FileVersion to dotnet publish. - tests: AssemblyMetadataTests verifies Company / Product / Copyright. Co-Authored-By: Claude Opus 4.8 --- Directory.Build.props | 22 +++++++++++++ scripts/pack.ps1 | 4 ++- .../AssemblyMetadataTests.cs | 32 +++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/CommandForge.Tests/AssemblyMetadataTests.cs diff --git a/Directory.Build.props b/Directory.Build.props index 791baae..7571b90 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,4 +23,26 @@ $(NoWarn);CS1591 + + + CommandForge + poli0981 + poli0981 + Copyright © 2026 poli0981 + Run complex Windows system commands through a visual, categorized interface. + https://github.com/poli0981/CommandForge + https://github.com/poli0981/CommandForge + git + 1.0.0 + + diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 18826d7..0217dcc 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -37,7 +37,7 @@ Write-Host "Publishing CommandForge $Version ($Runtime, $Configuration)..." -For dotnet publish $wpfProject ` -c $Configuration -r $Runtime --self-contained true ` -p:PublishSingleFile=false ` - -p:Version=$Version -p:InformationalVersion=$Version ` + -p:Version=$Version -p:FileVersion=$Version -p:InformationalVersion=$Version ` -o $publishDir # vpk is the Velopack CLI: dotnet tool install -g vpk @@ -48,6 +48,8 @@ if (-not (Get-Command vpk -ErrorAction SilentlyContinue)) { Write-Host "Packing with Velopack..." -ForegroundColor Cyan vpk pack ` --packId CommandForge ` + --packTitle CommandForge ` + --packAuthors poli0981 ` --packVersion $Version ` --packDir $publishDir ` --mainExe CommandForge.Wpf.exe diff --git a/tests/CommandForge.Tests/AssemblyMetadataTests.cs b/tests/CommandForge.Tests/AssemblyMetadataTests.cs new file mode 100644 index 0000000..255288d --- /dev/null +++ b/tests/CommandForge.Tests/AssemblyMetadataTests.cs @@ -0,0 +1,32 @@ +using System.Reflection; +using CommandForge.Domain; + +namespace CommandForge.Tests; + +/// +/// Verifies the package/assembly metadata declared in Directory.Build.props is stamped into +/// the built assemblies. This metadata is surfaced in Settings -> About, the Report-Bug +/// template, the file properties, and the Velopack installer (--packAuthors). +/// +public sealed class AssemblyMetadataTests +{ + // Domain is the lowest layer and inherits the same Directory.Build.props metadata as the rest. + private static readonly Assembly Target = typeof(CommandDefinition).Assembly; + + [Fact] + public void Assembly_HasExpectedCompany() + => Assert.Equal("poli0981", Target.GetCustomAttribute()?.Company); + + [Fact] + public void Assembly_HasExpectedProduct() + => Assert.Equal("CommandForge", Target.GetCustomAttribute()?.Product); + + [Fact] + public void Assembly_HasCopyrightWithOwner() + { + var copyright = Target.GetCustomAttribute()?.Copyright; + + Assert.NotNull(copyright); + Assert.Contains("poli0981", copyright, StringComparison.Ordinal); + } +}