[研究]NPOI.2.7.6 -> NPOI.2.8.0 升級,關於 NPOI: You must accept the OSMF EULA license to use NPOI. Add 訊息
2026-04-17
ASP.NET WebForm 的 NPOI.2.7.6 -> NPOI.2.8.0 升級後,
Visual Studio 2019 做 Compile/Build 後出現下面訊息?甚麼意思?OSMF又是甚麼?
已開始重建...
1>------ 已開始全部重建: 專案: PMSWeb, 組態: Debug Any CPU ------
1>C:\Git\Solution1\WebApplication1\packages\NPOI.2.8.0\build\NPOI.targets(8,5): warning : NPOI: You must accept the OSMF EULA license to use NPOI. Add <AcceptNPOIOSMFLicense>true</AcceptNPOIOSMFLicense> to your project file.
1> PMSWeb -> C:\Git\Solution1\WebApplication1\WebApplication1\bin\WebApplication1.dll
2>------ 已開始全部重建: 專案: WebApplication1.Tests, 組態: Debug Any CPU ------
********************************************************************************
ChatGPT
這個訊息其實不是錯誤,是 NuGet/建置時的「授權提醒 warning」,你的專案還是已經正常 Build 成功了。
🔎 這段訊息在說什麼?
warning : NPOI: You must accept the OSMF EULA license to use NPOI.
Add <AcceptNPOIOSMFLicense>true</AcceptNPOIOSMFLicense> to your project file.
意思是:
👉 NPOI 2.8.0 開始,要求你在專案中明確「同意某個授權條款」
👉 否則在 build 時會跳 warning 提醒你
📌 OSMF 是什麼?
這裡的 OSMF 指的是:Open Specifications / Microsoft File format 相關授權條款
簡單講就是:
- NPOI 在讀寫 Excel(.xls / .xlsx)時
- 會涉及 Microsoft Office Open XML(OOXML)格式規範
- 因此 NuGet 套件要求你「明確接受使用條款」
👉 它不是一個你要安裝的東西
👉 也不是 runtime 元件
👉 只是「授權確認機制」
⚠️ 這個 warning 會影響程式嗎?
不會。
- ✔ Build 成功
- ✔ 程式可正常執行
- ✔ Excel 讀寫不受影響
- ❗ 只有警告訊息
🛠️ 如何消除 warning?
到你的 .csproj 加上這一行:
|
🧠 補充(為什麼 2.8.0 才出現?)
因為:
- NPOI 新版開始「更嚴格處理 NuGet 授權聲明」
- 用 MSBuild target (NPOI.targets) 強制檢查
- 避免商用環境未確認 license
✅ 總結
| 項目 | 說明 |
|---|---|
| OSMF | Office Open XML / Microsoft 文件格式授權相關 |
| 問題 | 授權確認 warning |
| 影響 | 無(不影響 build / runtime) |
| 解法 | csproj 加 <AcceptNPOIOSMFLicense>true</...> |
(完)
沒有留言:
張貼留言