Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
048144b7e0 | ||
|
|
2f0ee71093 |
@@ -59,6 +59,12 @@ description: SharpDevelop 5.x WinForms 设计器**全部工具箱**(5 分类 8
|
||||
- **依赖清单**:所需引用的资源文件(图标/图片/resx)、组件库与依赖程序集(Designer.cs 用到增强控件时,同一次改动先写 csproj 引用,见第 3 条);
|
||||
- **数据接口**:窗口与其他系统模块(主窗口/数据库/停靠布局/外部进程)的数据交互方式与调用入口。
|
||||
窗口一律采用双文件结构:`窗口名.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,10 @@ selftest_result.txt
|
||||
!成套报价软件/lib/*.dll
|
||||
# 例外:tools\ 下的 WebView2 引导程序是打包必需件
|
||||
!tools/MicrosoftEdgeWebview2Setup.exe
|
||||
# 例外:release 里的 Inno Setup 脚本是手工维护的打包正本,必须进版本控制
|
||||
# (gitignore 否定规则限制:父目录被排除时无法重新包含深层文件,须逐层放行)
|
||||
!release/
|
||||
release/*
|
||||
!release/成套报价软件
|
||||
release/成套报价软件/*
|
||||
!release/成套报价软件/setup.iss
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
; ============================================================
|
||||
; 成套报价软件 安装包脚本 — Inno Setup 6
|
||||
; 文件必须保存为 UTF-8 with BOM 编码(中文才能正确显示)
|
||||
; ============================================================
|
||||
|
||||
[Code]
|
||||
// ★ WebView2 运行时检测(2026-09-21 新装机实测:精简系统没装过 Edge 时所有内嵌网页窗口全黑)
|
||||
// 三处注册表任一存在有效版本即视为已装(64位系统机器级/32位视图/当前用户级)
|
||||
// (标识符必须 ASCII——Inno 的 Check 表达式解析不接受中文函数名)
|
||||
function WebView2RegOk(Root: Integer; SubKey: String): Boolean;
|
||||
var
|
||||
v: String;
|
||||
begin
|
||||
Result := RegQueryStringValue(Root, SubKey, 'pv', v) and (Length(v) > 2) and (Pos('0.0.0.0', v) = 0);
|
||||
end;
|
||||
|
||||
function NeedWebView2(): Boolean;
|
||||
begin
|
||||
Result := not (
|
||||
WebView2RegOk(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}') or
|
||||
WebView2RegOk(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}') or
|
||||
WebView2RegOk(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}')
|
||||
);
|
||||
end;
|
||||
|
||||
// 升级安装:清理旧版遗留的 cadcj(旧 AutoCAD 插件)与 libredwg 目录(2026-09-04 退役)
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
begin
|
||||
if CurStep = ssInstall then
|
||||
begin
|
||||
if DirExists(ExpandConstant('{app}\cadcj')) then
|
||||
DelTree(ExpandConstant('{app}\cadcj'), True, True, True);
|
||||
if DirExists(ExpandConstant('{app}\libredwg-0.13.4.8043-win64')) then
|
||||
DelTree(ExpandConstant('{app}\libredwg-0.13.4.8043-win64'), True, True, True);
|
||||
end;
|
||||
end;
|
||||
|
||||
[Setup]
|
||||
AppName=成套报价软件
|
||||
; ★ 版本号与 AssemblyInfo.cs 的 AssemblyVersion 同步(tools\递增版本号.ps1 统一递增)
|
||||
AppVersion=1.0.3
|
||||
AppPublisher=成套报价软件
|
||||
AppId={{8F3A7C21-6B54-4E2D-9A71-5C8B20260825}
|
||||
DefaultDirName=C:\成套报价软件
|
||||
DefaultGroupName=成套报价软件
|
||||
DisableProgramGroupPage=yes
|
||||
OutputDir=Output
|
||||
; ★ 安装包文件名带版本号(多版本下载不混淆),与 AppVersion 同步
|
||||
OutputBaseFilename=成套报价软件_Setup_1.0.3
|
||||
Compression=lzma2
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
; 程序为 x86(32位)编译,但可在 64 位 Windows 上运行
|
||||
ArchitecturesAllowed=x64 x86
|
||||
PrivilegesRequired=admin
|
||||
|
||||
; ★ 支持直接覆盖安装升级:
|
||||
; CloseApplications=yes —— 安装时检测到本软件正在运行,提示一键关闭后再继续,
|
||||
; 避免旧 exe/DLL 被占用导致替换失败(表现为"装了新版但还是旧功能");
|
||||
; RestartApplications=no —— 不用重启延迟替换,当场完成替换。
|
||||
CloseApplications=yes
|
||||
RestartApplications=no
|
||||
|
||||
; 安装包自身与卸载项图标
|
||||
SetupIconFile=app.ico
|
||||
UninstallDisplayIcon={app}\app.ico
|
||||
UninstallDisplayName=成套报价软件
|
||||
|
||||
[Languages]
|
||||
Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "创建桌面快捷方式(&D)"; GroupDescription: "附加图标:"
|
||||
Name: "importdata"; Description: "安装 GCS 铜排计算工具(&M)"; GroupDescription: "可选组件(仅铜排壳体计算需要):"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
; ★ WebView2 运行时官方引导程序(仅安装期用,装进 {tmp} 不落安装目录):
|
||||
; 新电脑缺运行时(元件库/CAD扒图/AI助手等所有内嵌网页窗口的底层)时静默安装,
|
||||
; 引导程序联网从微软 CDN 下载——不依赖 GitHub;已装过则整个跳过
|
||||
Source: "MicrosoftEdgeWebview2Setup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
|
||||
; 主程序 + 配置 + 图标
|
||||
Source: "成套报价软件.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "成套报价软件.exe.config"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "app.ico"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; 功能区按钮图标
|
||||
Source: "icons\*"; DestDir: "{app}\icons"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; 开源许可证全文(关于窗口「查看许可证全文」用,亦是协议义务的随附声明)
|
||||
Source: "licenses\*"; DestDir: "{app}\licenses"; Flags: ignoreversion
|
||||
; 元件库网页(node 纯本地静态服务数据,替代旧 python 代理)
|
||||
Source: "元件库网页\*"; DestDir: "{app}\元件库网页"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
||||
; 依赖 DLL
|
||||
Source: "AdvancedDataGridView.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "Smart.CustomComponents.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "WeifenLuo.WinFormsUI.Docking.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "System.Data.SQLite.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "System.Resources.Extensions.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "System.Memory.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "System.Numerics.Vectors.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "System.Runtime.CompilerServices.Unsafe.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "Microsoft.Web.WebView2.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "Microsoft.Web.WebView2.WinForms.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "WebView2Loader.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; ★ 2026-09-11 补:主程序扒图 PdfiumNative P/Invoke 根目录 pdfium.dll,上包(9-10)漏装,装机能用仅因手动同步过安装目录
|
||||
Source: "pdfium.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "NPOI.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "NPOI.OOXML.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "NPOI.OpenXml4Net.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "NPOI.OpenXmlFormats.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "DotNetZip.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "ICSharpCode.SharpZipLib.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "unvell.ReoGrid.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "CJZZ.Controls.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; 核心数据目录(项目库/用户库/柜体库/母排规格库等程序必需文件,必装)
|
||||
Source: "sjk\*"; DestDir: "{app}\sjk"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "shezhi\*"; DestDir: "{app}\shezhi"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; 甲方报表 Excel 模板(按图号/按箱号/按箱号+箱体面积/按箱类型)
|
||||
Source: "xiangmu\*"; DestDir: "{app}\xiangmu"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; CAD 扒图(独立程序,默认安装)
|
||||
Source: "cadbt\*"; DestDir: "{app}\cadbt"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; PDF 扒图(独立程序+OCR 环境,默认安装)
|
||||
Source: "pdfbt\*"; DestDir: "{app}\pdfbt"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; AI 助手引擎(ZCode 开源版 zai-org/ZCode,Apache-2.0:zcode 发行包+捆绑 node+预置+启停 cmd;zcode数据 运行时自建不进包)
|
||||
Source: "ai助手\*"; DestDir: "{app}\ai助手"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; 会员服务器不进包(2026-09-22 用户长期规则:客户端默认连云端 https://ss61.odn.cc,部署套件单独交付)
|
||||
Source: "GCS铜排壳体计算\*"; DestDir: "{app}\GCS铜排壳体计算"; Flags: ignoreversion recursesubdirs createallsubdirs; Tasks: importdata
|
||||
|
||||
[Dirs]
|
||||
; 各项目报价库存放目录(空目录,程序运行时在里面建库)
|
||||
Name: "{app}\sjk\bjb"
|
||||
|
||||
[InstallDelete]
|
||||
; ★ 覆盖安装升级前,先删掉旧版主程序和依赖 DLL,保证不会残留旧功能文件。
|
||||
; 只清安装根目录({app})下的程序文件:通配符不含子目录,
|
||||
; cadcj/libredwg/GCS铜排壳体计算 等工具目录不受影响;
|
||||
; 用户数据都在子目录里(sjk 项目库、shezhi 企业信息、停靠布局等),全部保留。
|
||||
Type: files; Name: "{app}\成套报价软件.exe"
|
||||
Type: files; Name: "{app}\*.dll"
|
||||
|
||||
[Icons]
|
||||
; 开始菜单
|
||||
Name: "{group}\成套报价软件"; Filename: "{app}\成套报价软件.exe"; IconFilename: "{app}\app.ico"; Comment: "电气成套设备报价软件"
|
||||
Name: "{group}\卸载 成套报价软件"; Filename: "{uninstallexe}"
|
||||
; 桌面快捷方式
|
||||
Name: "{commondesktop}\成套报价软件"; Filename: "{app}\成套报价软件.exe"; IconFilename: "{app}\app.ico"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
; ★ WebView2 运行时缺失时先静默装好再启动软件(所有内嵌网页窗口的底层;
|
||||
; 已装过的机器 Check 返回 False 整条跳过,不联网不弹窗)
|
||||
Filename: "{tmp}\MicrosoftEdgeWebview2Setup.exe"; Parameters: "/silent /install"; StatusMsg: "正在安装 WebView2 运行时(内嵌网页功能必需)..."; Flags: runhidden waituntilterminated; Check: NeedWebView2
|
||||
Filename: "{app}\成套报价软件.exe"; Description: "立即启动 成套报价软件"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[UninstallDelete]
|
||||
; 卸载时彻底清理安装目录(含运行时生成的数据库/备份/日志)
|
||||
Type: filesandordirs; Name: "{app}"
|
||||
@@ -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.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all the values or you can use the default the Revision and
|
||||
// Build Numbers by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
// ★ 版本号唯一事实源(2026-10-01 起):格式 主.次.修订.0——每次发版必须递增修订号,
|
||||
// 用 tools\递增版本号.ps1 一键同步(关于软件自动读这里;setup.iss 由脚本同步)。
|
||||
// 不要用 "1.0.*" 自动号(每次编译都变,无法对应发布的安装包)。
|
||||
[assembly: AssemblyVersion("1.0.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.3.0")]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 关于软件:经典关于页模板(页头 图标/名称/版本/简介 + 选项卡 功能介绍|开源致谢 + 底部版权栏)
|
||||
// 关于软件:经典关于页模板(页头 图标/名称/版本/简介 + 选项卡 功能介绍|开源致谢 + 底部版权栏)
|
||||
// 富文本用 SelectionColor/Font 逐段设置(■ 小节标题深蓝加粗、协议名按协议配色,纯 WinForms 无新依赖)
|
||||
using System;
|
||||
using System.Drawing;
|
||||
@@ -16,6 +16,10 @@ namespace 成套报价软件
|
||||
// 页头排版在 Load 里做(AutoScale 完成后):版本号紧随软件名实际宽度、
|
||||
// 简介对齐软件名左侧,避免高 DPI 下固定坐标互相压字;图标 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) =>
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user