2026年4月14日 星期二

[研究]ClosedXML 0.105.0 是否相依 System.ValueTuple 測試

[研究]ClosedXML 0.105.0 是否相依 System.ValueTuple 測試

2025-04-07

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 20.2

續這篇

[研究]System.ValueTuple 4.5.0 升級到 4.6.x 後執行出錯
https://shaurong.blogspot.com/2026/04/systemvaluetuple-450-46x.html

********************************************************************************

NuGet 安裝ClosedXML 0.105.0

********************************************************************************

WebApplication1

正在安裝:

DocumentFormat.OpenXml.Framework.3.1.1

DocumentFormat.OpenXml.3.1.1

ExcelNumberFormat.1.1.0

Microsoft.Bcl.HashCode.1.1.1

RBush.Signed.4.0.0

System.Buffers.4.5.1

System.Numerics.Vectors.4.5.0

System.Runtime.CompilerServices.Unsafe.4.7.0

System.Memory.4.5.5

ClosedXML.Parser.2.0.0

SixLabors.Fonts.1.0.0

ClosedXML.0.105.0

********************************************************************************

更新

********************************************************************************

WebApplication1

更新:

SixLabors.Fonts.1.0.0 -> SixLabors.Fonts.2.1.3

System.Memory.4.5.5 -> System.Memory.4.6.3

System.Runtime.CompilerServices.Unsafe.4.7.0 -> System.Runtime.CompilerServices.Unsafe.6.1.2

System.Numerics.Vectors.4.5.0 -> System.Numerics.Vectors.4.6.1

System.Buffers.4.5.1 -> System.Buffers.4.6.1

Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1 -> Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0

Microsoft.Bcl.HashCode.1.1.1 -> Microsoft.Bcl.HashCode.6.0.0

DocumentFormat.OpenXml.3.1.1 -> DocumentFormat.OpenXml.3.5.1

DocumentFormat.OpenXml.Framework.3.1.1 -> DocumentFormat.OpenXml.Framework.3.5.1

********************************************************************************

下面,編譯失敗

********************************************************************************

嚴重性 程式碼 說明 專案 檔案 隱藏項目狀態

錯誤 無法安裝封裝 'SixLabors.Fonts 2.1.3'。您正嘗試將此封裝安裝到以 '.NETFramework,Version=v4.8' 為目標的專案,但該封裝不包含任何與架構相容的組件參考或內容檔。如需詳細資訊,請連絡封裝作者。

********************************************************************************
SixLabors.Fonts 2.1.3 不支援 .NET Framework 4.8(或沒有提供可用的 compatible assets)

********************************************************************************
不要升級 SixLabors.Fonts 2.1.3,其他再升級一次
********************************************************************************

WebApplication1

更新:

System.Memory.4.5.5 -> System.Memory.4.6.3

System.Runtime.CompilerServices.Unsafe.4.7.0 -> System.Runtime.CompilerServices.Unsafe.6.1.2

System.Numerics.Vectors.4.5.0 -> System.Numerics.Vectors.4.6.1

System.Buffers.4.5.1 -> System.Buffers.4.6.1

Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1 -> Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0

Microsoft.Bcl.HashCode.1.1.1 -> Microsoft.Bcl.HashCode.6.0.0

DocumentFormat.OpenXml.3.1.1 -> DocumentFormat.OpenXml.3.5.1

DocumentFormat.OpenXml.Framework.3.1.1 -> DocumentFormat.OpenXml.Framework.3.5.1

********************************************************************************

packages.config


<?xml version="1.0" encoding="utf-8"?> <packages> <package id="ClosedXML" version="0.105.0" targetFramework="net48" /> <package id="ClosedXML.Parser" version="2.0.0" targetFramework="net48" /> <package id="DocumentFormat.OpenXml" version="3.5.1" targetFramework="net48" /> <package id="DocumentFormat.OpenXml.Framework" version="3.5.1" targetFramework="net48" /> <package id="ExcelNumberFormat" version="1.1.0" targetFramework="net48" /> <package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net48" /> <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" /> <package id="RBush.Signed" version="4.0.0" targetFramework="net48" /> <package id="SixLabors.Fonts" version="1.0.0" targetFramework="net48" /> <package id="System.Buffers" version="4.6.1" targetFramework="net48" /> <package id="System.Memory" version="4.6.3" targetFramework="net48" /> <package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net48" /> <package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net48" /> </packages>

並沒有用到  System.ValueTuple 

(完)

相關

[研究]System.ValueTuple 4.5.0 升級到 4.6.x 後執行出錯

[研究]System.ValueTuple 4.5.0 升級到 4.6.x 後執行出錯

2025-04-14

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 20.2

********************************************************************************

ASP.NET WebForm Web Application 專案 System.ValueTuple 4.5.0 升級到 4.6.x 後,編譯成功,執行匯出會錯誤,出現

'/' 應用程式中發生伺服器錯誤。
無法載入檔案或組件 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 或其相依性的其中之一。 系統找不到指定的檔案。
描述: 在執行目前 Web 要求的過程中發生未處理的例外狀況。請檢閱堆疊追蹤以取得錯誤的詳細資訊,以及在程式碼中產生的位置。

例外狀況詳細資訊: System.IO.FileNotFoundException: 無法載入檔案或組件 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 或其相依性的其中之一。 系統找不到指定的檔案。

原始程式錯誤:


行 284:        catch (Exception)
行 285:        {
行 286:            throw;
行 287:        }
行 288:    }

原始程式檔: C:\Temp5\\Solution\WebApplication\Admin\Logs.aspx.cs    行: 286

堆疊追蹤:


[FileNotFoundException: 無法載入檔案或組件 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 或其相依性的其中之一。 系統找不到指定的檔案。]
   SixLabors.Fonts.StreamFontMetrics..ctor(TrueTypeFontTables tables) +0
   SixLabors.Fonts.StreamFontMetrics.LoadTrueTypeFont(FontReader reader) +892
   SixLabors.Fonts.FontCollection.AddImpl(Stream stream, CultureInfo culture, FontDescription& description) +92
   ClosedXML.Graphics.DefaultGraphicEngine.AddEmbeddedFont(FontCollection fontCollection) in /_/ClosedXML/Graphics/DefaultGraphicEngine.cs:258
   ClosedXML.Graphics.DefaultGraphicEngine..ctor(String fallbackFont) in /_/ClosedXML/Graphics/DefaultGraphicEngine.cs:69
   ClosedXML.Graphics.<>c.<.cctor>b__31_0() in /_/ClosedXML/Graphics/DefaultGraphicEngine.cs:55
   System.Lazy`1.CreateValue() +734
   System.Lazy`1.LazyInitValue() +189
   ClosedXML.Excel.XLWorkbook..ctor(LoadOptions loadOptions) in /_/ClosedXML/Excel/XLWorkbook.cs:784
   Admin_Logs.Button_Export_Xlsx_by_ClosedXML_Click(Object sender, EventArgs e) in C:\Temp5\\Solution\WebApplication\Admin\Logs.aspx.cs:286
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +138
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5445

版本資訊: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.8.4797.0

**********

ChatGPT   

Web.Config 出錯


<dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly>

改為


<dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.7.0" newVersion="4.0.7.0" /> </dependentAssembly>


執行 Update-Package System.ValueTuple -Reinstall


因為

Package Version Assembly Version
4.5.x 4.0.3.0
4.6.x 4.0.4.0~4.0.7.0

⚠️ ClosedXML 0.105 + SixLabors.Fonts 1.0.1

這組合有 2 個問題:

❌ 問題 1

SixLabors.Fonts 1.0.1 很舊

→ .NET Framework binding 相容性不好

❌ 問題 2

ClosedXML 0.105 在 Graphics engine 會強制載入 font engine

→ 直接觸發 ValueTuple load chain

**********

編譯成功,但有警告

已開始重建...

1>------ 已開始全部重建: 專案: WebApplication1, 組態: Debug Any CPU ------

1>  請考慮將組件 "System.ValueTuple, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" 的 app.config 從版本 "4.0.3.0" [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\System.ValueTuple.dll] 重新對應至版本 "4.0.5.0" [C:\Git\Solution1\WebApplication1\packages\System.ValueTuple.4.6.2\lib\net47\System.ValueTuple.dll],以解決衝突並避免出現警告。

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5): warning MSB3247: 在同一個相依組件的不同版本之間發現衝突。請在 Visual Studio 中按兩下這個警告 (或選取後按 Enter) 解決這些衝突,或者將下列繫結重新導向加到應用程式組態檔中的 [執行階段] 節點: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.ValueTuple" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" /><bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" /></dependentAssembly></assemblyBinding>

1>  WebApplication1 -> C:\Git\Solution1\WebApplication1\WebApplication1\bin\WebApplication1.dll

2>------ 已開始全部重建: 專案: WebApplication1.Tests, 組態: Debug Any CPU ------

2>  請考慮將組件 "System.ValueTuple, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" 的 app.config 從版本 "4.0.3.0" [C:\Git\Solution1\WebApplication1\WebApplication1\bin\System.ValueTuple.dll] 重新對應至版本 "4.0.5.0" [C:\Git\Solution1\WebApplication1\packages\System.ValueTuple.4.6.2\lib\net47\System.ValueTuple.dll],以解決衝突並避免出現警告。

2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5): warning MSB3247: 在同一個相依組件的不同版本之間發現衝突。請在 Visual Studio 中按兩下這個警告 (或選取後按 Enter) 解決這些衝突,或者將下列繫結重新導向加到應用程式組態檔中的 [執行階段] 節點: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.ValueTuple" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" /><bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" /></dependentAssembly></assemblyBinding>

2>  WebApplication1.Tests -> C:\Git\Solution1\WebApplication1\WebApplication1.Tests\bin\Debug\WebApplication1.Tests.dll

========== 全部重建: 2 成功、0 失敗、 0 略過 ==========


========== 全部重建: 2 成功、0 失敗、 0 略過 ==========

、、、、略,ChatGPT 又說要改回 4.0.5.0,然後又重複相同問題。

(待續)

相關

2026年3月31日 星期二

[研究]uTorrent.exe疑問

[研究]uTorrent.exe疑問

2026-03-31

 Windows Server 2019,每次 uTorrent.exe 開始載入某 .torrent 就會出現


病毒與威脅防護
未經授權的變更已遭封鎖
受控資料夾存取被阻止uTorrent.exe 進行
更改·按一下以查看設定。

正常嗎?

**********

這在 Windows Server 2019 中是正常現象,但這代表 Windows Defender 的「受控資料夾存取」(Controlled Folder Access)功能正在發揮作用,但也干擾了 uTorrent 的正常運作。

這是因為該功能為了防範勒索病毒,會鎖定「文件」、「下載」等核心資料夾,禁止未經許可的程式寫入檔案。由於 uTorrent 正在嘗試將下載的檔案寫入這些受保護的資料夾,系統便判定為「未經授權的變更」並予以攔截。

以下是處理此問題的建議步驟:

1. 解決方案:將 uTorrent 加入允許清單

如果您確認使用的 uTorrent 是官方安全版本,且信任其行為,可以手動授權:

  1. 點擊該通知,或進入 [開始] > [設定] > [更新與安全性] > [Windows 安全性]。
  2. 選擇 [病毒與威脅防護]。
  3. 點擊 [管理勒索軟體防護]。
  4. 點擊 [讓應用程式通過受控資料夾存取]。
  5. 點擊 [新增允許的應用程式],找到 uTorrent.exe 的安裝路徑並選取它。

2. 為什麼會發生?(技術背景)

項目說明
觸發功能Windows Defender 的 受控資料夾存取 (Controlled Folder Access)
判定邏輯系統將 uTorrent 視為外部執行檔,當它嘗試在 C:\Users\帳號\DownloadsDocuments 建立新資料夾/檔案時,會被視為潛在風險。
風險提示uTorrent 常因綑綁廣告或被偵測為 PUA (可能不需要的應用程式) 而被防毒軟體列入黑名單,這也是攔截的原因之一。

3. 進階設定建議

如果您在 Windows Server 2019 上跑下載任務,可以考慮以下優化:

  1. 更換下載目錄: 將 uTorrent 的下載路徑更改為非系統保護的磁區(例如 D:\Downloads),通常可以避開此安全性攔截。
  2. 考慮替代方案: uTorrent 近年的版本較多廣告且安全性評價不一,在伺服器環境下,許多技術人員偏好使用更乾淨、開源的 qBittorrent,其相容性與安全性通常較佳。
  3. 如果您不打算讓此程式更動資料夾,則無需理會該通知,但 uTorrent 將無法成功下載任何檔案。

**********

但 uTorrent  的下載目錄不是預設目錄,我設定在 D: 的某目錄

即便下載目錄設在 D:,Windows Server 2019 的「受控資料夾存取」依然可能攔截 uTorrent.exe。這通常是因為以下兩個原因:

1. D: 的目錄被納入「受保護的資料夾」

Windows Defender 預設雖然只保護系統目錄(如 Documents、Downloads),但用戶或系統管理員可以手動將其他磁碟機(如 D:\Downloads)加入保護名單。

確認方式: 進入 [管理勒索軟體防護] > [受保護的資料夾],檢查清單中是否有包含您在 D: 設定的目錄。

2. uTorrent 嘗試修改「設定檔」或「中繼資料」

即使下載目標在 D:,uTorrent.exe 在載入 .torrent 時,通常會同時執行以下動作:

  • 寫入 AppData: 嘗試在 C:\Users\使用者名稱\AppData\Roaming\uTorrent 寫入 Resume 資訊或 Session 資料。
  • 寫入暫存檔: 某些版本會預設在系統磁碟建立隱藏的 .dat 或 .old 備份檔。
  • 受控攔截: 只要 uTorrent 在執行過程中觸碰到任一受保護的路徑(不一定是下載目錄),系統就會跳出該通知。

建議處理方式

您可以透過以下表格中的步驟,針對 Windows Server 2019 進行更精確的設定:

步驟操作說明
A. 排除程式 (推薦)在「受控資料夾存取」中點選 [讓應用程式通過...],直接把 uTorrent.exe 加入允許清單。這是最直接的方法。
B. 排除目錄若不想放行程式,請在 [病毒與威脅防護設定] > [排除項目] 中,將您的 D: 下載目錄加入排除。
C. 檢視具體原因點擊通知進入 [防護歷程記錄],展開該筆攔截紀錄,它會明確顯示 uTorrent.exe 當時正嘗試存取哪一個具體路徑

技術小叮嚀

在 Windows Server 2019 環境下,Windows Defender 的安全性權限通常比家用版更嚴格。如果您經常遇到這類攔截,建議將下載專用的資料夾徹底從「受控資料夾存取」的保護清單中移除,或將 uTorrent 設為信任的執行程式,否則每次載入新種子時,寫入 Resume 資料的動作都會被擋下,導致下載進度無法保存。

您目前的 uTorrent.exe 是安裝版還是免安裝(Portable)版?如果是免安裝版,建議將整個程式目錄也加入排除清單。

(完)

[研究]顯示未接網路線的RJ45網卡的 MAC Address (Win11)

[研究]顯示未接網路線的RJ45網卡的 MAC Address (Win11)

2026-03-31

顯示未接網路線的RJ45網卡的 MAC Address (Windows 11)

可在「命令提示字元」輸入 getmac 或 getmac /v 檢視


(完)

2026年3月28日 星期六

[研究]Word 2029左上角 eSignature

[研究]Word 2019左上角 eSignature

2026-03-28

Word 2019左上角 eSignature 按鈕,這是 Word 2019 本來就有的?還是甚麼軟體在 Word 2019 另外安裝的的外掛、擴充?



這個 eSignature 按鈕並非 Microsoft Word 2019 原生內建的功能,而是透過 外掛程式(Add-in) 或某種 電子簽章軟體 額外安裝到 Word 中的。

原生 Word 的簽名功能通常位於「插入」索引標籤下的「簽名欄」,並不會在工具列上出現專屬的 eSignature 大圖示。

可能的來源與辨識方法

這類按鈕通常來自於專業的電子簽署服務廠商。您可以透過以下步驟確認它是哪一個軟體:

1. 常見的來源廠商

  • DocuSign / Adobe Sign: 這是最常見的兩大廠商,安裝其桌面版或增益集後,會出現在 Word 的工具列。
  • 各國當地的簽章服務: 像是台灣的 點點簽 (DottedSign)、凱鈿 (Kdan),或是政府/企業內部使用的憑證簽章軟體。
  • PDF 編輯器外掛: 如果您有安裝 Foxit PDF 或其他 PDF 工具,它們有時會自動將簽章套件整合進 Word。

2. 如何在 Word 中確認它是什麼?

  1. 您可以透過以下兩個地方查看這個外掛的真實身分:
  2. 路徑 A(COM 增益集):
  3. 點擊 Word 左上角的 「檔案」 -> 「選項」。
  4. 選擇左側的 「增益集」。
  5. 在下方「管理」下拉選單選擇 「COM 增益集」,然後按 「執行」。
  6. 清單中勾選的項目,通常就會顯示該 eSignature 的軟體名稱。

3. 如果想移除它

如果您不需要這個功能,可以在上述的 「COM 增益集」 視窗中取消勾選,該按鈕就會從工具列消失。如果要徹底刪除,則需從 Windows 的「控制台」或「設定」中的「應用程式與功能」找到該軟體並卸載。






看來是 Adobe Acrobat Reader DC 安裝的。

(完)