1

找對 NuGet Package 的小技巧

 2 years ago
source link: https://blog.darkthread.net/blog/pick-correct-nuget-package/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

找對 NuGet Package 的小技巧

calendar.svg 2022-03-11 09:56 PM comment.svg 0 eye.svg 786

.NET 社群蓬勃發展,NuGet Gallery 上程式套件多如牛毛,搜尋時常會冒出一堆名稱相近結果,不知哪個才是我要的,歷經幾次裝錯經驗,以下是我找對 NuGet 程式庫的小技巧。

前陣子玩繁簡轉換找到 OpenCC.NET 專案,作者說 OpenCC.NET 名稱已被捷足先登,故在 NuGet Gallery 上架名稱是 OpenCCNet,這類有連結或指明名稱的狀況還好。前天做Bouncy Castle DES/AES 加解密,官網沒有提供 NuGet 套件名稱(或是有說但我沒找到),在 NuGet Gallery 用 BouncyCastle 查尋找到 BouncyCastle、Portable.BouncyCastle、BouncyCastle.NetCore,不知道要哪個才是正版,錯裝了第一筆(關聯度最高者)才發現它不支援 .NET Core... 後來留意到,可以看套件名稱旁的藍勾勾,代表 nuget.org 認證過的原作者(類似臉書的藍勾勾):

NuGet Gallery 預設是以 Relevance (與關鍵字的關聯度) 排序,最相關的一筆常常是名字取得好,用下載量排序可信度還高一些:

另外,Frameworks 頁籤會顯示程式庫適用的 .NET 版本,快速判斷是否與你的專案相容:(.NET Standard 2.0 代表 .NET 4.6.1+ 跟 .NET Core/.NET 5+ 專案可使用)

Visual Studio 的 NuGet Manager 也能查到類似資料。(VSCode 也有相關套件 (NuGet Package Manager GUI For VSCodeNuGet Package Manager),但搜尋操作介面不如 VS。)

小結,以關鍵字搜尋 NuGet 套件若遇多筆雷同,以通過官方認證者優先,若無則依序比下載數、套件版號、最後更新日期,再確認支援 .NET 版本,基本上可八九不離十。

and has 0 comments

Comments

Be the first to post a comment

Post a comment

Comment
Name Captcha 30 + 3 =

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK