Visual Studio 2019 的新功能What's new in Visual Studio 2019

16.8 版的更新Updated for the 16.8 release

使用 Visual Studio 2019,您會獲得同類產品中最佳的工具和服務,任何開發人員、任何應用程式及任何平台均適用。With Visual Studio 2019, you'll get best-in-class tools and services for any developer, any app, and any platform. 無論您是第一次使用 Visual Studio,還是使用了數年的時間,我們最新的版本都有很大的需要!Whether you're using Visual Studio for the first time or you've been using it for years, there's a lot to like in our latest version!

以下是最新功能的概要回顧:Here's a high-level recap of what's new, all-up:

  • 開發:利用改良的效能、即時程式碼清除及更好的搜尋結果,保持焦點和生產力。Develop: Stay focused and productive with improved performance, instant code cleanup, and better search results.
  • 共同 作業:透過 Git 優先工作流程、即時編輯和偵錯工具,以及直接在 Visual Studio 中進行程式碼審核,享受自然的共同作業。Collaborate: Enjoy natural collaboration through a Git-first workflow, real-time editing and debugging, and code reviews right in Visual Studio.
  • Debug:反白顯示並流覽至特定值、優化記憶體使用量,以及取得應用程式執行的自動快照集。Debug: Highlight and navigate to specific values, optimize memory use, and take automatic snapshots of your application's execution.

如需此版本中所有新功能的完整清單,請參閱版本資訊For a complete list of everything that's new in this version, see the release notes.

開發Develop

檢視下列影片以深入了解如何使用新功能來節省時間。View the following video to learn more about how you can save time with new features.

影片長度:3.00 分鐘Video length: 3.00 minutes

先前稱為「快速啟動」,新的搜尋體驗將更快速且更有效。Formerly known as Quick Launch, our new search experience is faster and more effective. 現在,搜尋結果會隨著您的鍵入以動態方式顯示。Now, search results appear dynamically as you type. 此外,搜尋結果通常會包含命令的鍵盤快速鍵,讓您輕鬆記憶,以便日後使用。And, search results can often include keyboard shortcuts for commands, so that you can more easily memorize them for future use.

Visual Studio 2019 中的新搜尋體驗動畫An animation of the new search experience in Visual Studio 2019

無論有無錯字,新的模糊搜尋邏輯都能找出您所需的任何項目。The new fuzzy search logic will find anything you need, regardless of typos. 因此,不論您要尋找命令、設定、文件或其他使用項目,新搜尋功能可讓您更輕鬆找到您要尋找的內容。So, whether you're looking for commands, settings, documentation, or other useful things, the new search feature makes it easier to find what you're looking for.

重構Refactorings

C# 中有許多全新且非常有用的重構,讓您輕鬆就能組織您的程式碼。There are lots of new and highly useful refactorings in C# that make it easier to organize your code. 它們顯示為燈泡中的建議,且包含動作,如將成員移動至介面或基底類別、調整命名空間以符合資料夾結構、將 foreach 迴圈轉換為 Linq 查詢等等。They show up as suggestions in the light bulb and include actions such as moving members to interface or base class, adjusting namespaces to match folder structure, convert foreach-loops to Linq queries, and more.

Visual Studio 2019 中的重構體驗動畫An animation of the refactorings experience in Visual Studio 2019

只要按下 Ctrl+.,來叫用重構Simply invoke the refactorings by pressing Ctrl+. 然後選取您想要採取的動作。and selecting the action you want to take.

IntelliCodeIntelliCode

Visual Studio IntelliCode 可使用人工智慧 (AI) 來強化您的軟體開發工作。Visual Studio IntelliCode enhances your software development efforts by using artificial intelligence (AI). IntelliCode 在 GitHub 上的 2,000 個開放原始碼專案中訓練 (每個專案各有超過 100 顆星) 以產生建議。IntelliCode trains across 2,000 open-source projects on GitHub—each with over 100 stars—to generate its recommendations.

Visual Studio 2019 中的 IntelliCode 動畫An animation of IntelliCode in Visual Studio 2019

以下是 Visual Studio IntelliCode 可協助提高生產力的幾種方式:Here are a few ways that Visual Studio IntelliCode can help enhance your productivity:

  • 提供內容感知的程式碼完成Deliver context-aware code completions
  • 引導開發人員遵守所屬團隊的模式與風格Guide developers to adhere to the patterns and styles of their team
  • 找出難以捕捉的程式碼問題Find difficult-to-catch code issues
  • 將注意力放在真正重要的區域,專注在程式碼檢閱上Focus code reviews by drawing attention to areas that really matter

一開始以 Visual Studio 的延伸模組形式提供 IntelliCode 預覽時,我們僅支援 C#。We initially supported only C# when we first previewed the IntelliCode as an extension for Visual Studio. 現在,我們也新增了對 C++ 和 XAML 的「內建」支援,以作為 16.1 版的新功能Now, new in 16.1, we've added support for C# and XAML "in-the-box". (不過,對 C++ 和 TypeScript/JavaScript 的支援目前仍為預覽狀態)。(Support for C++ and TypeScript/JavaScript are still in preview, however.)

如果您使用 C#,我們也新增了以您的程式碼訓練自訂模型的能力。And if you're using C#, we've also added the ability to train a custom model on your own code.

如需 IntelliCode 的詳細資訊,請參閱 Announcing the general availability of IntelliCode plus a sneak peek (宣告 IntelliCode 正式運作與搶先預覽) 以及 Code more, scroll less with Visual Studio IntelliCode (使用 Visual Studio IntelliCode 撰寫更多程式碼並捲動更少) 部落格文章。For more information about IntelliCode, see the Announcing the general availability of IntelliCode plus a sneak peek and Code more, scroll less with Visual Studio IntelliCode blog posts.

程式碼清除Code cleanup

新的程式碼清除命令會與新文件健康狀態指標搭配。Paired with a new document health indicator is a new code cleanup command. 您可以使用這個新命令,以單一動作 (或按一下按鈕) ,來識別並修正警告和建議。You can use this new command to identify and then fix both warnings and suggestions with a single action (or click of a button).

清除作業會設定程式碼格式,並套用由目前的設定.editorconfig 檔案所建議的任何程式碼修正。The cleanup will format the code and apply any code fixes as suggested by the current settings and .editorconfig files.

Visual Studio 2019 中的新程式碼清除控制項螢幕擷取畫面A screenshot of the new code cleanup control in Visual Studio 2019

您也可以將修正程式集合儲存為設定檔。You can also save collections of fixers as a profile. 例如,如果您有一組較少的目標修正程式經常在編寫程式碼時套用,然後在程式碼檢閱之前會套用另一組完整的修正程式,您可以將設定檔設定為處理這些不同的工作。For example, if you have a small set of targeted fixers that you apply frequently while you code, and then you have another comprehensive set of fixers to apply before a code review, you can configure profiles to address these different tasks.

Visual Studio 2019 中設定程式碼清除控制項的螢幕擷取畫面A screenshot of the configure code cleanup control in Visual Studio 2019

個別監視器感知 (PMA) 轉譯Per-monitor aware (PMA) rendering

如果您以不同顯示比例因素設定監視器,或從遠端連線到具有不同於您主要裝置顯示比例因素的機器,您可能會發現 Visual Studio 的顯示模糊,或以錯誤的比例轉譯。If you use monitors that are configured with different display scale factors, or connect remotely to a machine with display scale factors that are different from your main device, you might notice that Visual Studio looks blurry or renders at the wrong scale.

Visual Studio 2019 的發行,代表我們正著手將 Visual Studio 調整為個別監視器感知 (PMA) 應用程式。With the release of Visual Studio 2019, we're making Visual Studio a per-monitor aware (PMA) application. 現在,不論您使用的顯示縮放比例為何,Visual Studio 均可正確轉譯。Now, Visual Studio renders correctly regardless of the display scale factors you use.

Visual Studio 2019 中的個別監視器感知 (PMA) 轉譯Per-monitor aware (PMA) rendering in Visual Studio 2019

如需詳細資訊,請參閱使用 Visual Studio 2019 獲得更好的多監視器體驗 (英文) 部落格文章。For more information, see the Better multi-monitor experience with Visual Studio 2019 blog post.

測試總管Test Explorer

16.2 的新 功能:我們已更新 Test Explorer,以提供更好的處理大型測試集、更輕鬆的篩選、更容易探索的命令、索引標籤式的播放清單,以及可自訂的欄,讓您微調顯示的測試資訊。New in 16.2: We've updated Test Explorer to provide better handling of large test sets, easier filtering, more discoverable commands, tabbed playlist views, and customizable columns that let you fine-tune what test information is displayed.

顯示測試總管中的使用者介面改良功能的螢幕擷取畫面A screenshot that shows the user interface improvements in the Test Explorer

.NET Core.NET Core

16.3 的新 功能:我們已包含 .net Core 3.0 的支援。New in 16.3: We've included support for .NET Core 3.0. Microsoft 的跨平臺、開放原始碼 — 及完全支援。Cross-platform, open source—and fully supported by Microsoft.

如需詳細資訊,請參閱 宣佈 .Net Core 3.0 的 blog 文章。For more information, see the Announcing .NET Core 3.0 blog post.

共同作業Collaborate

檢視下列影片以深入了解如何進行團隊合作來解決問題。View the following video to learn more about how you can team up to solve issues.

影片長度:4.22 分鐘Video length: 4.22 minutes

Git 優先工作流程Git-first workflow

開啟 Visual Studio 2019 時,您會注意到新的開始視窗。Something you'll notice when you open Visual Studio 2019 is its new start window.

Visual Studio 2019 中的新開始視窗螢幕擷取畫面A screenshot of the new start window in Visual Studio 2019

開始視窗會顯示數個選項,協助您快速編寫程式碼。The start window presents you with several options to get you to code quickly. 我們放置的選項可先複製,或從存放庫中簽出程式碼。We've placed the option to clone or check out code from a repo, first.

Visual Studio 2019 中的「Git 優先」體驗動畫An animation of the 'Git-first' experience in Visual Studio 2019

開始視窗也包含開啟專案或解決方案、開啟本機資料夾,或建立新專案的選項。The start window also includes options to open a project or solution, open a local folder, or create a new project.

如需詳細資訊,請參閱 取得程式碼:我們如何設計新的 Visual Studio 開始視窗的 blog 文章。For more information, see the Get to code: How we designed the new Visual Studio start window blog post.

Git 生產力Git productivity

16.8 的新 功能Git 現在是 Visual Studio 2019 中的預設版本控制體驗。New in 16.8 Git is now the default version control experience in Visual Studio 2019. 我們已根據您在過去兩個版本中的意見反應,建立功能集並逐一查看。We have built out the feature set and iterated on it based on your feedback during the past two releases. 所有人現在都已預設開啟新的體驗。The new experience has now been turned on by default for everyone. 您可以從新的 Git 功能表複製、建立或開啟存放庫。From the new Git menu, you can clone, create, or open repositories. 使用整合式 Git 工具視窗來認可和推送程式碼的變更、管理分支、隨時掌握遠端存放庫的最新狀態,以及解決合併衝突。Use the integrated Git tool windows to commit and push changes to your code, manage branches, stay up to date with your remote repositories, and resolve merge conflicts.

如需詳細資訊,請參閱 Visual Studio 頁面中的 Git 生產力For more information, see the Git productivity in Visual Studio page.

Live ShareLive Share

Visual Studio Live Share 這項開發人員服務可讓您與組員共用程式碼庫和其中的內容,並直接從 Visual Stuido 中進行即時雙向共同作業。Visual Studio Live Share is a developer service that allows you to share a codebase and its context with a teammate and get instant bidirectional collaboration directly from within Visual Studio. 組員可透過 Live Share 來閱讀、瀏覽、編輯和偵錯您與其共用的專案,過程相當自然且安全。With Live Share, a teammate can read, navigate, edit, and debug a project that you've shared with them, and do so seamlessly and securely.

Visual Studio 2019 預設會安裝這項服務。And with Visual Studio 2019, this service is installed by default.

顯示 Visual Studio 2019 中 Live Share 共同作業功能的動畫An animation that shows the Live Share collaboration feature in Visual Studio 2019

如需詳細資訊,請參閱 Visual Studio Live Share 提供即時程式碼檢閱與互動式教學 (英文) 部落格文章和 Visual Studio 2019 現已包含 Live Share (英文) 部落格文章。For more information, see the Visual Studio Live Share for real-time code reviews and interactive education blog post and the Live Share now included with Visual Studio 2019 blog post.

整合式程式碼檢閱Integrated code reviews

此次推出新的延伸模組,您可以下載並與 Visual Studio 2019 搭配使用。We're introducing a new extension that you can download to use with Visual Studio 2019. 使用這個新的延伸模組,您可以檢閱、執行偵錯要求,或是從您的團隊提取這些要求,而無需離開 Visual Studio。With this new extension, you can review, run, and even debug pull requests from your team without leaving Visual Studio. 我們支援 GitHub 和 Azure DevOps 存放庫中的程式碼。We support code in both GitHub and Azure DevOps repositories.

Visual Studio 2019 中新提取要求延伸模組的螢幕擷取畫面A screenshot of the new Pull Requests extension in Visual Studio 2019

如需詳細資訊,請參閱 Code reviews using the Visual Studio Pull Requests extension (使用 Visual Studio 提取要求延伸模組檢閱程式碼) 部落格文章。For more information, see the Code reviews using the Visual Studio Pull Requests extension blog post.

偵錯Debug

檢視下列影片以深入了解如何在進行偵錯時使用精確目標設定來集中精力。View the following video to learn more about how you can zero in with precise targeting while you debug.

影片長度:3.54 分鐘Video length: 3.54 minutes

效能提升Performance gains

我們採用僅一次的專屬 C++ 資料中斷點,並加以修改以用於 .NET Core 應用程式。We've taken the once-exclusive C++ data breakpoints and adapted them for .NET Core applications.

在 Visual Studio 2019 中顯示偵錯資料中斷點的動畫An animation that shows the debug data breakpoints in Visual Studio 2019

因此無論您在 C++ 或 .NET Core 中編寫程式碼,資料中斷點都是一般中斷點的理想替代方法。So whether you're coding in C++ or .NET Core, data breakpoints can be a good alternative to just placing regular breakpoints. 像是尋找要修改或新增或從清單中移除的全域物件,這類情節也非常適合使用資料中斷點。Data breakpoints are also great for scenarios such as finding where a global object is being modified or being added or removed from a list.

如果您是開發大型應用程式的 C++ 開發人員,Visual Studio 2019 還提供處理序外的符號,可讓您對這些應用程式偵錯,而不會發生記憶體相關的問題。And, if you're a C++ developer who develops large applications, Visual Studio 2019 has made symbols out of proc, which allows you to debug those applications without experiencing memory-related issues.

偵錯時搜尋Search while debugging

在 [監看式] 視窗中查看一組值中的字串,您先前可能已進行過。You've probably been there before, looking in the Watch window for a string amongst a set of values. 在 Visual Studio 2019 中,我們在 [監看式]、[區域變數] 和 [自動變數] 視窗中新增了搜尋功能,可協助您尋找物件和值。In Visual Studio 2019, we've added search in the Watch, Locals, and Autos windows to help you find the objects and values you're looking for.

在 Visual Studio 2019 中顯示偵錯搜尋視窗的動畫An animation that shows the debug search window in Visual Studio 2019

在 [監看式]、[區域變數] 和 [自動變數] 視窗的顯示方式,您也能加以格式化。You can also format how a value is displayed within the Watch, Locals, and Autos windows. ) 按兩下任何視窗中的其中一個專案來選取 (,然後新增逗號 ( "," ) 以存取可能格式規範的下拉式清單,其中每個都包含其預期效果的描述。Select (by double-clicking) one of the items in any of the windows and add a comma (",") to access the drop-down list of possible format specifiers, each of which includes a description of its intended effect.

Visual Studio 2019 中的新 [監看式] 視窗和格式值功能The new Watch window and format values feature in Visual Studio 2019

如需詳細資訊,請參閱 Visual Studio 2019 中的增強功能:在 [監看式]、[自動變數] 和 [區域變數] 視窗文章中搜尋物件和屬性For more information, see the Enhanced in Visual Studio 2019: Search for Objects and Properties in the Watch, Autos, and Locals Windows blog post.

快照集偵錯工具Snapshot Debugger

在雲端中取得應用程式執行的快照集,以查看確切的狀況。Get a snapshot of your app's execution in the cloud to see exactly what's happening. (僅 Visual Studio Enterprise 提供此功能)(This feature is available in Visual Studio Enterprise, only.)

顯示 Visual Studio 2019 Enterprise 中的快照集偵錯工具動畫An animation that shows the Snapshot Debugger in Visual Studio 2019 Enterprise

我們也新增對 Azure VM 上執行的目標 ASP.NET (Core 與傳統型) 應用程式的支援。We've added support for targeting ASP.NET (Core and desktop) applications that run on an Azure VM. 此外,我們新增對Azure Kubernetes Service 中所執行應用程式的支援。And, we've added support for applications that run in an Azure Kubernetes Service. 快照集偵錯工具可協助您大幅縮短為解決出現在生產環境之問題所花費的時間。The Snapshot Debugger can help you dramatically reduce the time it takes to resolve issues that occur in production environments.

如需詳細資訊請參閱使用快照偵錯工具針對即時 ASP.NET Azure 應用程式進行偵錯頁面,以及介紹 Visual Studio Enterprise 2019 的時間移動偵錯 (英文) 部落格文章。For more information, see the Debug live ASP.NET Azure apps using the Snapshot Debugger page, and the Introducing Time Travel Debugging for Visual Studio Enterprise 2019 blog post.

Microsoft Edge Insider 支援Microsoft Edge Insider support

16.2 中的新 功能:您可以在 JavaScript 應用程式中設定中斷點,並使用 Microsoft Edge Insider 瀏覽器啟動 debug 會話。New in 16.2: You can set a breakpoint in a JavaScript application and start a debug session by using the Microsoft Edge Insider browser. 當您這樣做的時候,Visual Studio 會在已啟用偵錯功能的情況下開啟新的瀏覽器視窗,讓您可以用來在 Visual Studio 內逐步執行應用程式 JavaScript。When you do so, Visual Studio opens a new browser window with debugging enabled, which you can then use to step through application JavaScript within Visual Studio.

瀏覽器中顯示 JavaScript 程式碼轉譯的螢幕擷取畫面A screenshot that shows JavaScript code rendering in a browser

可釘選屬性工具Pinnable Properties tool

16.4 的新 功能:現在,使用新的可釘選屬性工具進行偵錯工具時,可更輕鬆地依屬性來識別物件。New in 16.4: Now, it's easier to identify objects by their properties while debugging with the new Pinnable Properties tool. 只要將游標暫留在您要在 [監看式]、[自動變數] 和 [區域變數] 視窗的偵錯工具視窗中顯示的屬性上,選取釘選圖示,即可立即在視窗頂端看到您要尋找的資訊!Just hover the cursor over a property you want to display in the debugger window of the Watch, Autos, and Locals windows, select the pin icon, and immediately see the information you're looking for at the top of the window!

顯示如何使用可釘選屬性工具在 Visual Studio 偵錯工具中釘選屬性的動畫An animation that shows how to pin properties in the Visual Studio debugger by using the Pinnable Properties tool

如需詳細資訊,請參閱 可釘選屬性: Debug & 以您的方式將 Managed 物件顯示為您 的 blog 文章。For more information, see the Pinnable Properties: Debug & Display Managed Objects YOUR Way blog post.

後續步驟What's next

我們對 Visual Studio 2019 的更新通常附帶可大幅改善您開發體驗的新功能。We update Visual Studio 2019 often with new features that can make your development experience even better. 若要深入瞭解我們最新的創新,請參閱 Visual Studio 的 BlogTo learn more about our latest innovations, check out the Visual Studio Blog. 如需我們在預覽版本中發行之內容的記錄,請參閱 Preview 版本資訊。For a record of what we've released in preview to date, take a look at the Preview Release Notes. 如需我們接下來打算發行的內容清單,請參閱 Visual Studio 藍圖And for a list of what we're planning to release next, see the Visual Studio Roadmap.

此外,以下是目前工作中的一些新功能。Meanwhile, here are a few of our new features currently in the works.

  • GitHub Codespaces (Preview 的 Visual Studio 2019 支援)Visual Studio 2019 support for GitHub Codespaces (Preview)

    現在,開發人員在工作和家裡以使用了多個專案。Now more than ever, developers are juggling multiple projects at work and at home. 新功能、bug 修正、PR 評論、 & 原型全都競爭時間,而且需要持續的內容切換。New features, bug fixes, PR reviews, & prototypes all compete for time and require constant context-switching. GitHub Codespaces 可以提供協助。GitHub Codespaces can help. 您可以完全在雲端中進行開發,並在幾秒鐘內為每個專案建立專用的自訂環境。You can develop entirely in the cloud and create dedicated, custom environments for each of your projects in seconds. 使用 Visual Studio 2019,您可以連接到 codespace,並如同在本機運作。With Visual Studio 2019, you can connect to your codespace and work just as you would locally.

    如需詳細資訊,請參閱 什麼是 GitHub Codespaces 頁面。For more information, see the What is GitHub Codespaces page.

  • 改良 Visual Studio 2019 (Preview) 的 Git 體驗Improved Git experience in Visual Studio 2019 (Preview)

    雖然新的 Git 版本控制體驗現已在 Visual Studio 2019 16.8 版中預設為開啟,但我們仍會繼續新增功能,以增強最新預覽版本的體驗。Although the new Git version control experience is now on by default in Visual Studio 2019 version 16.8, we continue to add features to enhance the experience in the newest Preview release.

    如需詳細資訊,請參閱 Visual Studio 頁面中的 Git 生產力For more information, see the Git productivity in Visual Studio page.

如需預覽版本的詳細資訊 — 和下載連結,如果您想要試用, — 請參閱 Visual Studio 預覽 頁面。For more information about the Preview release—and a download link if you'd like to try it out—see the Visual Studio Preview page.

提供意見反應Give us feedback

為什麼要傳送意見反應給 Visual Studio 小組?Why send feedback to the Visual Studio team? 我們極為重視客戶的意見反應。Because we take customer feedback seriously. 它們是我們進步的動力。It drives much of what we do.

  • 如果您想要提出改善 Visual Studio 的建議,可以使用建議功能工具。If you want to make a suggestion about how we can improve Visual Studio, you can do so by using the Suggest a Feature tool.

  • 如果您遇到 Visual Studio 停止回應、當機或其他效能問題的問題,您可以使用 [回報 問題 ] 工具,輕鬆地與我們分享重現步驟和支援檔案。If you experience an issue where Visual Studio stops responding, crashes, or other performance issue, you can easily share repro steps and supporting files with us by using the Report a Problem tool.

請參閱See also