

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 Visual Studio 中创建 CloudFormation 模板项目
<a name="tkv-cfn-editor-new-project"></a>

 **创建模板项目** 

1. 在 Visual Studio 中，依次选择 **File (文件)**、**New (新建)** 和 **Project (项目)**。

1. **对于 Visual Studio 2017**：

   在**新建项目**对话框中，展开**已安装**，然后选择 **AWS**。  
![\[New Project dialog box showing CloudFormation and Lambda Function project options.\]](http://docs.aws.amazon.com/zh_cn/toolkit-for-visual-studio/latest/user-guide/images/CreateNewProject-04-CloudFormation-VS2017.png)

   **对于 Visual Studio 2019**：

   在**新建项目**对话框中，确保将**语言**、**平台**和**项目类型**下拉框都设置为“全部...”，然后在**搜索**字段中键入 **aws**。  
![\[Project template options for AWS 服务, including Lambda, CloudFormation, and Serverless applications.\]](http://docs.aws.amazon.com/zh_cn/toolkit-for-visual-studio/latest/user-guide/images/CreateNewProject-04-CloudFormation-VS2019.png)

1. 选择**AWS CloudFormation 项目**模板。

1. **对于 Visual Studio 2017**：

   为您的模板项目输入所需的**名称**、**位置**等，然后单击**确定**。

   **对于 Visual Studio 2019**：

   单击**下一步**。在下一个对话框中，为您的模板项目输入所需的**名称**、**位置**等，然后单击**创建**。

1. 在 **Select Project Source (选择项目源)** 页面上，选择您将创建的模板的源：
   +  **Create with empty template (使用空模板创建)** 生成新的空 CloudFormation 模板。
   +  **从现有 AWS \$1CFN\$1 堆栈创建**从您账户中的现有堆栈生成一个模板。 AWS （该堆栈不需要具有状态 `CREATE_COMPLETE`。）
   +  **Select sample template (选择示例模板)** 从 CloudFormation 示例模板之一生成模板。  
![\[CloudFormation project creation window with options for template source selection.\]](http://docs.aws.amazon.com/zh_cn/toolkit-for-visual-studio/latest/user-guide/images/vs-editor-new-template-empty-2.png)

1. 要完成 CloudFormation 模板项目的创建，请选择 “**完成**”。