建立新的專案Create a New Project

開啟專案建立對話方塊Opening the Project Creation Dialog

有幾種方式可在 Visual Studio for Mac 中建立新的專案。There are a few ways to create a new project in Visual Studio for Mac. 當您第一次開啟 Visual Studio for Mac 時,會顯示 [開始] 視窗。When you first open Visual Studio for Mac, the start window is shown. 您可以從這裡選擇 [ 新增 ],這會帶您前往專案建立畫面。From here you can choose New which takes you to the project creation screen.

提示

此外,在 [開始] 視窗中,您也可以開啟和搜尋最近使用的專案和方案。Additionally, from the start window, you can also open and search for recent projects and solutions. 您也可以移至功能表列並選擇 [檔案] > [最近使用的解決方案]You can also open recent projects by going to the menu bar and choosing File > Recent Solutions

具有建立新專案的 [開始] 視窗

如果 Visual Studio for Mac 已經開啟並載入解決方案,您可以移至功能表列並選擇 [檔案] > [新增解決方案] 來建立新的解決方案。If Visual Studio for Mac is already open with a solution loaded, you can create a new solution by going to the menu bar and choosing File > New Solution. 以此方式建立新的解決方案會關閉已載入的方案。Creating a new solution this way closes the solution that is already loaded.

建立新專案Creating a New Project

[新增專案] 對話方塊預設會顯示您最近使用的範本,並依「最近用過的順序」排序。The New Project dialog, by default, will show your recently used templates sorted by most recently used.

如果您不想要使用最近用過的範本,您可以從對話方塊左側的類別中選擇。If you do not want to use a recent template, you can choose from the categories on the left of the dialog. 每個類別都包含數個專案範本供您選擇。Each category contains several project templates for you to choose from. 按一下專案類型可讓您在畫面右側查看描述。Clicking on a project type allows you to see a description on the right side of the screen.

新增專案畫面

設定您的新專案Configuring Your New Project

在您選擇專案範本之後,後續畫面將會引導您完成設定該專案所需的任何設定步驟;這些步驟可能會因專案類型而有所不同。Once you have chosen a project template, the following screens will take you through any configuration steps required to set up the project; this can vary by project type.

所有專案都需要新的專案,以及儲存檔案的位置。All projects require a new project, along with a location to store the files. 如果該專案是新解決方案的一部分,而不是要將它加入至現有的解決方案,則也會需要提供解決方案名稱。If the project is part of a new solution, rather than adding it to an existing solution, a solution name will also be required.

在此階段您也可以選擇設定 Git 原始檔控制選項。Optionally, at this stage you can also configure Git source control options. 下圖是某個 .NET Core 專案最終設定步驟的範例:The following image is an example of the final configuration step for a .NET Core project:

設定新專案

將其他專案新增至解決方案Adding Additional Projects to a Solution

您可以用滑鼠右鍵按一下 [ 方案] 視窗 中的方案,然後選擇 [ > 加入新專案 ] 或 [加入 > 加入現有專案 ],將其他專案新增至方案。You can add additional projects to a solution by right-clicking the solution in the Solution Window and choosing either Add > Add New Project or Add > Add Existing Project.

加入新專案將會引導您完成專案建立程序,如設定您的新專案中所示。Adding a new project will take you through project creation, as shown in Configuring Your New Project.

選擇加入現有專案將可讓您瀏覽電腦上的現有專案,並將它加入至解決方案。Choosing to add an existing project will allow you to browse for an existing project on your machine and add it to the solution.

請參閱See also