Compartilhar via


How to: Create a SharePoint Web Part by using a designer

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can create a web part by adding a Visual Web Part item to any SharePoint project. This opens the Visual Web Developer designer in Visual Studio where you can add controls and code to the web part. Visual web parts function the same way as web parts do. The only difference is that you design visual web parts in the Visual Web Developer designer.

To create a project for visual web parts

  1. On the menu bar, choose File >New > Project.
  1. In the New Project dialog box, under either Visual C# or Visual Basic, expand the Office/SharePoint node, and then choose the SharePoint Solutions category.

  2. In the list of project templates, choose SharePoint 2013 - Visual Web Part, and then choose the OK button.

    The SharePoint Customization Wizard appears.

  1. On the Specify the site and security level for debugging page, specify the URL of a SharePoint site that's on the local computer, and then choose the Finish button.

    In Solution Explorer, a web part appears. After designing the web part in the Visual Web Developer designer, you'll test it on the site that you specify.

To add a visual web part to an existing SharePoint project

  1. On the menu bar, choose Project > Add New Item.

  2. In the Add New Item dialog box, choose the Office/SharePoint node.

  3. In the list of project templates, choose Visual Web Part, name it, and then choose the Add button.

    In Solution Explorer, your web part appears. After designing the web part in the Visual Web Developer designer, you'll test it on the site that you specify.

See also