Secure deployment

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

When you create an Office solution, your development computer is updated automatically to allow the code in your project to run. However, when you deploy your solution, you must provide evidence on which to base a trust decision by signing the solution with a certificate, or using the ClickOnce trust prompt key. For more information, see Grant trust to Office solutions.

Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects. See Features available by Office application and project type.

For document-level customizations, if you deploy the document to a network location, you must also add the document's location to the list of trusted locations in the Trust Center of the Office application. For more information about how to set document permissions on end-user computers, see Grant trust to documents.

Prevent Office solutions from running code

Administrators can use the registry to prevent all Office solutions from running on a computer. When an Office solution that has managed code extensions is opened, the Visual Studio Tools for Office runtime checks whether an entry with the name Disabled exists under one of the following registry keys on the computer:

  • HKEY_CURRENT_USER\Software\Microsoft\VSTO

  • HKEY_LOCAL_MACHINE\Software\Microsoft\VSTO

    To prevent Office solutions from running code, create a Disabled entry under one or both of these registry keys, and specify one of the following data types and values for Disabled:

  • A REG_SZ or REG_EXPAND_SZ that is set to any string other than "0" (zero).

  • A REG_DWORD that is set to any value other than 0 (zero).

    To enable Office solutions to run code, set both of the Disabled entries to 0 (zero), or delete the registry entries.

See also