2025年4月28日 星期一

[研究]ASP.NET,HtmlSanitizer.9.0.876 升級 HtmlSanitizer.9.0.884 測試

[研究]ASP.NET,HtmlSanitizer.9.0.876 升級 HtmlSanitizer.9.0.884 測試

2025-04-28

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

因為某專案把HtmlSanitizer.9.0.876 升級 HtmlSanitizer.9.0.884 後,編譯 (重建方案) 有警告,而且發布 (Deploy) 後,居然無法運作,建立全新方案測試看看。

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

【遇到的問題】

已開始重建...

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" [],以解決衝突並避免出現警告。

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 -> D:\WebSolution1\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:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\System.ValueTuple.dll] 重新對應至版本 "4.0.5.0" [],以解決衝突並避免出現警告。

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 -> D:\WebSolution1\WebApplication1\WebApplication1.Tests\bin\Debug\WebApplication1.Tests.dll

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

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

【全新專案,NuGet 安裝 HtmlSanitizer.9.0.876】

WebApplication1

正在安裝:

System.Buffers.4.5.1

System.Numerics.Vectors.4.5.0

System.Runtime.CompilerServices.Unsafe.6.0.0

System.Memory.4.5.5

System.Collections.Immutable.9.0.1

System.Text.Encoding.CodePages.6.0.0

AngleSharp.0.17.1

AngleSharp.Css.0.17.0

HtmlSanitizer.9.0.876


【編譯正常】

已開始重建...

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

1>  WebApplication1 -> C:\WebSolution1\WebApplication1\WebApplication1\bin\WebApplication1.dll

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

********************************************************************************
【升級到 HtmlSanitizer.9.0.884】

WebApplication1

更新:

HtmlSanitizer.9.0.876 -> HtmlSanitizer.9.0.884

正在安裝:

System.ValueTuple.4.6.1

【編譯正常,沒有警告】

已開始重建...

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

1>  WebApplication1 -> C:\WebSolution1\WebApplication1\WebApplication1\bin\WebApplication1.dll

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

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

也就是原來方案的 Web.config 或 app.config 要添加或修改 System.ValueTuple 的一些設定。

(完)

沒有留言:

張貼留言