Skip to content

Commit 5d22229

Browse files
firejeff01claude
andcommitted
Default MSI build to self-contained (~66MB)
- build-msi.ps1: 預設 self-contained 模式(含 .NET 8 runtime) - 加 -Slim 切換為 framework-dependent (~5MB) 模式 - 保留向下相容 -SelfContained switch - README 更新系統需求:使用者免裝 runtime Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bc556fc commit 5d22229

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
### 系統需求
2020

2121
- **作業系統**:Windows 10/11 (x64)
22-
- **執行環境**:.NET 8 Desktop Runtime(`TenderSearch.msi` 為 framework-dependent,需先安裝 runtime)
23-
- 下載:<https://dotnet.microsoft.com/download/dotnet/8.0/runtime>
24-
- 或建置 self-contained MSI:`.\build\build-msi.ps1 -SelfContained`(檔案會變大到 ~80MB)
22+
- **執行環境****無需另外安裝**。MSI 預設為 self-contained,內含 .NET 8 Desktop Runtime。
23+
- 若要建小體積版(需使用者另外裝 .NET 8 runtime):`.\build\build-msi.ps1 -Slim`
2524

2625
---
2726

@@ -253,8 +252,8 @@ dotnet run --project src/Tender.Crawler -- --mode manual --target-date 2026-05-0
253252
如果只想本機測試 build 是否正常、不發版:
254253

255254
```powershell
256-
.\build\build-msi.ps1 # 自動產生時間版本號
257-
.\build\build-msi.ps1 -SelfContained # 含 .NET 8 runtime(~80MB
255+
.\build\build-msi.ps1 # 自動產生時間版本號(預設 self-contained ~80MB)
256+
.\build\build-msi.ps1 -Slim # framework-dependent ~5MB(需使用者已裝 .NET 8)
258257
.\build\build-msi.ps1 -Version "1.0.0.0" # 強制指定版本(測試降版)
259258
```
260259

build/build-msi.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@
1616
param(
1717
[ValidateSet('Debug', 'Release')]
1818
[string]$Configuration = 'Release',
19+
# 預設 self-contained(含 .NET 8 runtime,~80MB,使用者不用先裝 runtime)。
20+
# 加 -Slim 改成 framework-dependent(~5MB,但使用者要先裝 .NET 8 Desktop Runtime)。
21+
[switch]$Slim,
22+
# 舊參數,保留向下相容(與 Slim 相反義)
1923
[switch]$SelfContained,
2024
# 強制指定版本號;省略時自動依目前時間產生 1.{year-2025}.{MMDD}.{HHmm}
2125
[string]$Version
2226
)
2327

28+
# 決定 self-contained:預設 true,-Slim 才轉成 false
29+
$useSelfContained = -not $Slim
30+
2431
$ErrorActionPreference = 'Stop'
2532

2633
$repoRoot = Split-Path -Parent $PSScriptRoot
@@ -39,15 +46,15 @@ if (-not $Version) {
3946
Write-Host "=== TenderSearch MSI Build ===" -ForegroundColor Cyan
4047
Write-Host "Repo: $repoRoot"
4148
Write-Host "Configuration: $Configuration"
42-
Write-Host "SelfContained: $SelfContained"
49+
Write-Host ("Mode: {0}" -f $(if ($useSelfContained) { 'self-contained (含 .NET 8 runtime, ~80MB)' } else { 'framework-dependent (slim, ~5MB)' }))
4350
Write-Host "Version: $Version"
4451

4552
# Step 1: Clean publish/dist
4653
if (Test-Path $pubRoot) { Remove-Item $pubRoot -Recurse -Force }
4754
if (-not (Test-Path $distRoot)) { New-Item -ItemType Directory -Path $distRoot | Out-Null }
4855

4956
# Step 2: Publish projects
50-
$selfContainedFlag = if ($SelfContained) { 'true' } else { 'false' }
57+
$selfContainedFlag = if ($useSelfContained) { 'true' } else { 'false' }
5158

5259
Write-Host ""
5360
Write-Host "[1/3] Publishing Tender.Crawler..." -ForegroundColor Yellow

0 commit comments

Comments
 (0)