Compartir a través de


How to: Create Office Projects in Visual Studio

You can use Visual Studio to create application-level add-ins and document-level customizations for Microsoft Office applications. For more information about these types of projects, see Office Solutions Development Overview.

Applies to: The information in this topic applies to document-level projects and application-level projects for Office 2013 and Office 2010. See Features Available by Office Application and Project Type.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.

To create an application-level add-in project

  1. On the File menu, choose New, Project. If your integrated development environment (IDE) is set to use Visual Basic development settings, on the File menu, choose New , Project.

    The New Project dialog box appears.

    Note

    Office projects target the .NET Framework 4.5 by default. For more information, see .NET Framework Client Profile.

  2. In the templates pane, under the node for the language you want to use, expand Office/SharePoint.

  3. Choose the Office Add-ins node.

  4. In the list of project templates, select an add-in project template. For a list of available add-in project templates, see Office Project Templates Overview.

    Note

    If project templates are not visible when you select the Office Add-ins node, make sure that .NET Framework 4 or .NET Framework 4.5 is selected in the combo box at the top of the dialog box. Office project templates are visible for both versions of the .NET Framework.

  5. In the Name box, type a name for the project. By default, the project name is also used as the solution name.

  6. In the Location box, enter the path where you want to create the project. You can use absolute and universal naming convention (UNC) paths. Do not use HTTP, FTP, or other protocol paths.

    Locations have the following formats:

    • [drive]:\

    • \\Server\Share

    Do not use these characters in the location:

    • Asterisk (*)

    • Vertical bar (|)

    • Colon (:) (Except following the drive letter.)

    • Double quotation mark (") (Paths that contain spaces do not need quotation marks.)

    • Less than (<)

    • Greater than (>)

    • Question mark (?)

    • Percent sign (%)

  7. Choose the OK button.

    Note

    Add-in projects are always saved when they are created. They cannot be created as temporary projects. For more information about temporary projects, see Temporary Projects.

To create a document-level customization project

  1. On the File menu, choose New, Project. If your IDE is set to use Visual Basic development settings, on the File menu, choose New, Project.

    The New Project dialog box appears.

    Note

    Office projects target the .NET Framework 4.5 by default.  For more information, see .NET Framework Client Profile.

  2. In the templates pane, under the node for the language you want to use, expand Office/SharePoint.

  3. Select the Office Add-ins node.

  4. In the list of project templates, select a document-level project template. For a list of available document-level project templates, see Office Project Templates Overview.

    Note

    If project templates are not visible when you select the Office Add-ins node, make sure that .NET Framework 4 or .NET Framework 4.5 is selected in the combo box at the top of the dialog box. Office project templates are visible for both versions of the .NET Framework.

  5. In the Name box, type a name for the project. By default, this name is also used for the document. If your IDE is set to use Visual C# development settings or General development settings, also enter a location and solution name.

    Note

    You cannot use surrogate characters in the path of the project location or in the project name. For information about surrogate characters, see Unicode Support for Surrogate Pairs and Combining Character Sequences. Also, if you plan to deploy the solution for use offline, the characters in the project name must fit the HTTP protocol specifications.

  6. Choose the OK button.

    The Visual Studio Tools for Office Project Wizard opens.

  7. Select Create a new document if you want to create a new document for the solution, or select Copy an existing document if you want to customize an existing document.

    If you create a new document, specify the name in the Name box and select the format of the document by using the Format box. For more information about the available formats, see Architecture of Document-Level Customizations.

    If you use an existing document, specify the location of the document in the Full path of the existing document box. You can use absolute and UNC paths. Do not use HTTP, FTP, or other protocol paths to the document.

    Locations have the following formats:

    • [drive]:\

    • \\Server\Share

    Do not use these characters in the location:

    • Asterisk (*)

    • Vertical bar (|)

    • Colon (:) (Except following the drive letter.)

    • Double quotation mark (") (Paths that contain spaces do not need quotation marks.)

    • Less than (<)

    • Greater than (>)

    • Question mark (?)

    • Percent sign (%)

    Note

    If you use an existing document in a Word 2013 project, only use documents that were created in or converted to Word 2013. Similarly, if you use an existing document in a Word 2010 project, only use documents that were created in or converted to Word 2010. Certain features will be disabled in the document if you use a document that was created in an earlier version of Word. If you try to write code that uses these features, you might encounter errors in your project. To convert a document, open it in Word 2013 or Word 2010, on the File tab on the ribbon, choose Info, Convert.

  8. Choose Finish.

  9. Add the project folder and its subfolders to the list of trusted locations in the Trust Center in Word in the following cases:

    • You are creating a Word Document that is based on a .docm file, and the document contains a VBA project or hosts Windows Forms controls. Adding the project folder to the list of trusted locations will help make sure that the document works as expected at design time.

    • You are creating a Word Template project that is based on a .dotx file. You must add the project folder to the list of trusted locations so that you can run and debug the project.

    For more information on how to add a document to the trusted locations, see the Microsoft Office Online web site Create, remove, or change a trusted location for your files.

See Also

Concepts

Collaborative Development of Office Solutions

Getting Started Programming Application-Level Add-Ins

Other Resources

Office Project Templates Overview

Designing and Creating Office Solutions