在 Visual Studio 中建立新專案

在本文中,我們將說明如何從範本快速在 Visual Studio 中建立新專案。

開啟 [建立新專案] 對話方塊

在 Visual Studio 中建立新的專案有多種方式。 當您第一次開啟 Visual Studio 時會顯示 [開始] 視窗,您可在此選取 [建立新專案]

Screenshot of the 'Create a new project' dialog from the start window in Visual Studio 2019

如已開啟 Visual Studio 開發環境,您就可以選擇功能表列的 [檔案]> [新增]> [專案]。 您也可以選取工具列上的 [新增專案] 按鈕,或按 Ctrl+Shift+N

Screenshot of the New Project button in Visual Studio 2019.

開啟 [建立新專案] 對話方塊

在 Visual Studio 中建立新的專案有多種方式。 當您第一次開啟 Visual Studio 時會顯示 [開始] 視窗,您可在此選取 [建立新專案]

Screenshot of the 'Create a new project' dialog from the start window in Visual Studio 2022.

如已開啟 Visual Studio 開發環境,您就可以選擇功能表列的 [檔案]> [新增]> [專案]。 您也可以選取工具列上的 [新增專案] 按鈕,或按 Ctrl+Shift+N

Screenshot of the New Project button in Visual Studio 2022.

選取範本類型

在 [建立新專案] 對話方塊上,您最近選取的範本清單會出現在左邊。 範本會依「最近使用」來排序。

如未從最近使用的範本中選取,您可依 [語言] (例如,C# 或 C++)、[平台] (例如 Windows 或 Azure) 和 [專案類型] (例如,Desktop 或 Web) 篩選所有可用的專案範本。 您也可以在 [搜尋] 方塊中輸入搜尋文字,進一步篩選範本;例如,asp.net

Screenshot of the project template filters in Visual Studio 2019.

出現在每個範本下的標籤會對應至三個下拉式清單篩選器 ([語言]、[平台] 和 [專案類型])。

提示

如未看到所尋找的範本,可能遺失了某個 Visual Studio 工作負載。 若要安裝額外的工作負載;例如,Azure 開發使用 .NET 進行行動開發,請選取 [安裝更多工具與功能] 連結開啟 Visual Studio 安裝程式。 在此選取您想要安裝的工作負載,然後選取 [修改]。 然後,就有其他的專案範本可供選擇。

Screenshot of the 'Install more tools and features' link in Visual Studio 2019.

選取範本,然後選取 [下一步]

Screenshot of the project template filters in Visual Studio 2022.

出現在每個範本下的標籤會對應至三個下拉式清單篩選器 ([語言]、[平台] 和 [專案類型])。

提示

如未看到所尋找的範本,可能遺失了某個 Visual Studio 工作負載。 若要安裝額外的工作負載;例如,Azure 開發使用 .NET 進行行動開發,請選取 [安裝更多工具與功能] 連結開啟 Visual Studio 安裝程式。 在此選取您想要安裝的工作負載,然後選取 [修改]。 然後,就有其他的專案範本可供選擇。

Screenshot of the 'Install more tools and features' link in Visual Studio 2022.

選取範本,然後選取 [下一步]

設定您的新專案

[設定新專案] 對話方塊有選項可命名專案 (和解決方案)、選取磁碟位置,以及選取 Framework 版本 (如果適用於您選取的範本)。

Screenshot of the 'Configure your new project' dialog in Visual Studio 2019.

注意

如在已使用 Visual Studio 開啟專案或解決方案的情況下建立新的專案,則有額外的組態選項可用。 您可以選擇建立新的解決方案,或將新專案新增至已開啟的解決方案。

Screenshot of the 'Create new solution' or 'Add to solution' dialog in Visual Studio 2019.

選取 [建立] 建立新的專案。

設定您的新專案

[設定新專案] 對話方塊有選項可命名專案 (和解決方案)、選取磁碟位置等等。

Screenshot showing the Configure your new project dialog in Visual Studio 2022 and the options to set, including the project name and project location.

[其他資訊] 對話方塊包含選取架構版本、驗證類型等選項。

Screenshot of the Additional Information dialog in Visual Studio 2022 showing the selected .NET Framework version for the new project.

選取 [建立] 建立新的專案。

將另一個專案新增至方案

若要將其他專案新增至解決方案,請以滑鼠右鍵按一下 [方案總管] 中的解決方案節點,然後選取 [新增]>[新增專案]

提示

如需從頭開始建立的專案和方案範例,完整的逐步指示和範例程式碼,請參閱專案和方案簡介