版本号体系落地:AssemblyInfo 固定三段式 1.0.3 为唯一事实源(禁用 1.0.* 自动号);关于软件运行时读程序集版本;setup.iss 带版本号并纳入 git;新增 tools\递增版本号.ps1 一键递增三处同步(已自测往返);技能写入版本号铁律(每次发版必须递增)
This commit is contained in:
@@ -59,6 +59,12 @@ description: SharpDevelop 5.x WinForms 设计器**全部工具箱**(5 分类 8
|
|||||||
- **依赖清单**:所需引用的资源文件(图标/图片/resx)、组件库与依赖程序集(Designer.cs 用到增强控件时,同一次改动先写 csproj 引用,见第 3 条);
|
- **依赖清单**:所需引用的资源文件(图标/图片/resx)、组件库与依赖程序集(Designer.cs 用到增强控件时,同一次改动先写 csproj 引用,见第 3 条);
|
||||||
- **数据接口**:窗口与其他系统模块(主窗口/数据库/停靠布局/外部进程)的数据交互方式与调用入口。
|
- **数据接口**:窗口与其他系统模块(主窗口/数据库/停靠布局/外部进程)的数据交互方式与调用入口。
|
||||||
窗口一律采用双文件结构:`窗口名.Designer.cs`(纯布局与属性,SD 设计器能正确打开并继续编辑微调)+ `窗口名.cs`(交互逻辑与业务代码),Designer.cs 里绝不写业务代码;窗口文件记得同步注册进 csproj(Compile Include + Designer.cs 加 `<DependentUpon>`)。
|
窗口一律采用双文件结构:`窗口名.Designer.cs`(纯布局与属性,SD 设计器能正确打开并继续编辑微调)+ `窗口名.cs`(交互逻辑与业务代码),Designer.cs 里绝不写业务代码;窗口文件记得同步注册进 csproj(Compile Include + Designer.cs 加 `<DependentUpon>`)。
|
||||||
|
7. **版本号铁律(用户强制 2026-10-01):每次发版必须递增版本号**。每次打安装包/发 Gitea Release 前,必须先跑 `tools\递增版本号.ps1`(默认修订号 +1,如 1.0.3→1.0.4;大改动可传参指定如 1.1.0)。规则:
|
||||||
|
- **唯一事实源** = `成套报价软件\Properties\AssemblyInfo.cs` 的 `AssemblyVersion`(固定三段式 `主.次.修订.0`,**禁用 `1.0.*` 自动号**——每次编译都变,无法对应发布的安装包);
|
||||||
|
- 「关于软件」窗口运行时自动读程序集版本显示(不在 Designer 写死);
|
||||||
|
- `release\成套报价软件\setup.iss` 的 `AppVersion` 与 `OutputBaseFilename=成套报价软件_Setup_版本` 由脚本同步;
|
||||||
|
- Gitea Release 的 tag 与版本号一致(如 `v1.0.4`);
|
||||||
|
- 发版链固定为:递增版本号 → 编译 → make_package → ISCC → 更新包 → git 提交推送 → Release。跳过递增 = 两个不同功能的安装包同版本号,用户分不清、回滚排障全乱。
|
||||||
|
|
||||||
## 一、项目前提(缺一不可)
|
## 一、项目前提(缺一不可)
|
||||||
|
|
||||||
|
|||||||
@@ -51,3 +51,7 @@ selftest_result.txt
|
|||||||
!成套报价软件/lib/*.dll
|
!成套报价软件/lib/*.dll
|
||||||
# 例外:tools\ 下的 WebView2 引导程序是打包必需件
|
# 例外:tools\ 下的 WebView2 引导程序是打包必需件
|
||||||
!tools/MicrosoftEdgeWebview2Setup.exe
|
!tools/MicrosoftEdgeWebview2Setup.exe
|
||||||
|
# 例外:release 里的 Inno Setup 脚本是手工维护的打包正本,必须进版本控制
|
||||||
|
!release/
|
||||||
|
release/*
|
||||||
|
!release/成套报价软件/setup.iss
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# ============================================================
|
||||||
|
# 递增版本号.ps1 —— 版本号一键递增并三处同步
|
||||||
|
# ============================================================
|
||||||
|
# 唯一事实源: 成套报价软件\Properties\AssemblyInfo.cs 的 AssemblyVersion
|
||||||
|
# 同步点: ① AssemblyInfo.cs (AssemblyVersion + AssemblyFileVersion)
|
||||||
|
# ② release\成套报价软件\setup.iss (AppVersion + OutputBaseFilename)
|
||||||
|
# 关于软件窗口自动读程序集版本,无需同步。
|
||||||
|
# 用法:
|
||||||
|
# powershell -File tools\递增版本号.ps1 # 修订号 +1 (1.0.3 → 1.0.4)
|
||||||
|
# powershell -File tools\递增版本号.ps1 1.1.0 # 直接指定版本
|
||||||
|
# 发版流程: 本脚本 → 编译 → make_package → ISCC → 更新包 → git 提交推送
|
||||||
|
# → Gitea Release(tag 与版本号一致,如 v1.0.4)
|
||||||
|
# ============================================================
|
||||||
|
param([string]$SetVersion = "")
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$root = Split-Path -Parent $PSScriptRoot
|
||||||
|
$asm = Join-Path $root '成套报价软件\Properties\AssemblyInfo.cs'
|
||||||
|
$iss = Join-Path $root 'release\成套报价软件\setup.iss'
|
||||||
|
|
||||||
|
# --- 读当前版本 ---
|
||||||
|
$asmText = [System.IO.File]::ReadAllText($asm)
|
||||||
|
if ($asmText -notmatch 'AssemblyVersion\("(\d+)\.(\d+)\.(\d+)') {
|
||||||
|
Write-Host "[FAIL] AssemblyInfo.cs 里没找到三段式 AssemblyVersion" -ForegroundColor Red; exit 1
|
||||||
|
}
|
||||||
|
$cur = "{0}.{1}.{2}" -f $Matches[1], $Matches[2], $Matches[3]
|
||||||
|
|
||||||
|
# --- 算新版本 ---
|
||||||
|
if ($SetVersion -eq "") {
|
||||||
|
$new = "{0}.{1}.{2}" -f $Matches[1], $Matches[2], ([int]$Matches[3] + 1)
|
||||||
|
} else {
|
||||||
|
if ($SetVersion -notmatch '^\d+\.\d+\.\d+$') {
|
||||||
|
Write-Host "[FAIL] 版本号格式须为 主.次.修订,如 1.1.0" -ForegroundColor Red; exit 1
|
||||||
|
}
|
||||||
|
$new = $SetVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- ① AssemblyInfo: AssemblyVersion + AssemblyFileVersion ---
|
||||||
|
$asmText = $asmText -replace 'AssemblyVersion\("\d+\.\d+\.\d+[\.\d]*"\)', "AssemblyVersion(`"$new.0`")"
|
||||||
|
$asmText = $asmText -replace 'AssemblyFileVersion\("\d+\.\d+\.\d+[\.\d]*"\)', "AssemblyFileVersion(`"$new.0`")"
|
||||||
|
[System.IO.File]::WriteAllText($asm, $asmText, (New-Object System.Text.UTF8Encoding $true))
|
||||||
|
Write-Host "[OK] AssemblyInfo.cs: $cur -> $new"
|
||||||
|
|
||||||
|
# --- ② setup.iss: AppVersion + OutputBaseFilename ---
|
||||||
|
$issText = [System.IO.File]::ReadAllText($iss)
|
||||||
|
$issText = $issText -replace 'AppVersion=\d+\.\d+\.\d+', "AppVersion=$new"
|
||||||
|
$issText = $issText -replace 'OutputBaseFilename=成套报价软件_Setup[_\d\.]*', "OutputBaseFilename=成套报价软件_Setup_$new"
|
||||||
|
[System.IO.File]::WriteAllText($iss, $issText, (New-Object System.Text.UTF8Encoding $true))
|
||||||
|
Write-Host "[OK] setup.iss: AppVersion=$new, 安装包名=成套报价软件_Setup_$new.exe"
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "版本号已递增至 $new。后续步骤:"
|
||||||
|
Write-Host " 1. 编译主项目(csc @tools\verify_build.rsp)"
|
||||||
|
Write-Host " 2. python tools\make_package.py 组装发布目录"
|
||||||
|
Write-Host " 3. ISCC 编译安装包(文件名自动带 $new)"
|
||||||
|
Write-Host " 4. 更新包(make_update_package.py,目录名建议带版本)"
|
||||||
|
Write-Host " 5. git add+commit+push"
|
||||||
|
Write-Host " 6. Gitea Release: tag 用 v$new"
|
||||||
@@ -22,10 +22,8 @@ using System.Runtime.InteropServices;
|
|||||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The assembly version has following format :
|
// ★ 版本号唯一事实源(2026-10-01 起):格式 主.次.修订.0——每次发版必须递增修订号,
|
||||||
//
|
// 用 tools\递增版本号.ps1 一键同步(关于软件自动读这里;setup.iss 由脚本同步)。
|
||||||
// Major.Minor.Build.Revision
|
// 不要用 "1.0.*" 自动号(每次编译都变,无法对应发布的安装包)。
|
||||||
//
|
[assembly: AssemblyVersion("1.0.3.0")]
|
||||||
// You can specify all the values or you can use the default the Revision and
|
[assembly: AssemblyFileVersion("1.0.3.0")]
|
||||||
// Build Numbers by using the '*' as shown below:
|
|
||||||
[assembly: AssemblyVersion("1.0.*")]
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// 关于软件:经典关于页模板(页头 图标/名称/版本/简介 + 选项卡 功能介绍|开源致谢 + 底部版权栏)
|
// 关于软件:经典关于页模板(页头 图标/名称/版本/简介 + 选项卡 功能介绍|开源致谢 + 底部版权栏)
|
||||||
// 富文本用 SelectionColor/Font 逐段设置(■ 小节标题深蓝加粗、协议名按协议配色,纯 WinForms 无新依赖)
|
// 富文本用 SelectionColor/Font 逐段设置(■ 小节标题深蓝加粗、协议名按协议配色,纯 WinForms 无新依赖)
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
@@ -16,6 +16,10 @@ namespace 成套报价软件
|
|||||||
// 页头排版在 Load 里做(AutoScale 完成后):版本号紧随软件名实际宽度、
|
// 页头排版在 Load 里做(AutoScale 完成后):版本号紧随软件名实际宽度、
|
||||||
// 简介对齐软件名左侧,避免高 DPI 下固定坐标互相压字;图标 Zoom 充满框
|
// 简介对齐软件名左侧,避免高 DPI 下固定坐标互相压字;图标 Zoom 充满框
|
||||||
pic图标.SizeMode = PictureBoxSizeMode.Zoom;
|
pic图标.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
|
// ★ 版本号从程序集读取(唯一事实源=AssemblyInfo 的 AssemblyVersion,递增后这里自动跟随;
|
||||||
|
// Designer 里的 v1.0.0 只是设计期占位文本)。显示三段:主.次.修订
|
||||||
|
lbl版本.Text = "v" + System.Reflection.Assembly.GetExecutingAssembly()
|
||||||
|
.GetName().Version.ToString(3);
|
||||||
this.Load += (s, e) =>
|
this.Load += (s, e) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user