我的問題比較簡單,但是我在網上找不到答案。在哪里可以找到 Visual Studio 默認安裝哪些 .NET API,哪些需要單獨安裝?
例如
System.Threading.Tasks -> 使用 .Net 開發選項安裝 VS 后立即可用
System.IO.Ports -> 需要單獨安裝 NuGet 包才能使用
這取決于安裝的 .Net 版本還是其他一些因素?
uj5u.com熱心網友回復:
使用包管理器控制臺,您可以檢查它是否包含在內。
先查一下包是否存在:
Find-Package <Your Package>
用包做這件事System會給你類似的東西:
Id Versions Description
-- -------- -----------
System.Buffers {4.5.1} Provides resource pooling of any type for performance-critical applications that allocate and deallocate objects frequently....
System.Memory {4.5.4} Provides types for efficient representation and pooling of managed, stack, and native memory segments and sequences of such s...
System.Threading.Tasks.Extensions {4.5.4} Provides additional types that simplify the work of writing concurrent and asynchronous code....
...
如果你知道這個包是一個實際的包,那么你可以跳過上面的步驟并輸入:
Get-Package <Your Package>
如果它.NET默認包含在其中,您將收到以下訊息:
No packages installed.
否則你會得到類似的東西:
Id Versions Description
-- -------- -----------
MathParser.org-mXparser {4.4.2} mXparser is a super easy, rich, fast and highly flexible math expression parser library (parser and evaluator of mathematical...
Time Elapsed: 00:00:01.0141148
uj5u.com熱心網友回復:
是的,這取決于您使用的框架版本。使用 .NET Framework 時,默認情況下包含許多庫,而在 .NET Core / .NET 5.0 中,許多這些功能被移到單獨的 nuget 中。一些庫僅作為從某個版本開始的 nuget 存在,但這些版本甚至不一定鏈接到特定的運行時版本(例如,System.IO.Ports即使使用 .NET 5.0 或 .NET Framework 4.8,您也可以使用 v6.0.0)。
所以如果你需要一個型別而編譯器不知道它,你需要尋找nuget。Microsoft 檔案為每個類指明了在其中宣告它的程式集。nuget 通常以該程式集的名稱命名。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/426399.html
標籤:C# 。网 视觉工作室 .net-core .net 运行时
上一篇:`MAP_ANONYMOUS`在VisualStudio2019中未定義,帶有適用于Linux的Windows子系統
