Skip to content

Commit 8bef408

Browse files
authored
Merge pull request #908 from MicrosoftDocs/FromPublicMaster
Confirm merge from FromPublicMaster to master to sync with https://github.com/MicrosoftDocs/visualstudio-docs (branch master)
2 parents 51df218 + a9c3656 commit 8bef408

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

docs/ide/compiling-and-building-in-visual-studio.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ manager: "ghogen"
2020

2121
# Compiling and building in Visual Studio
2222

23-
Running a build creates assemblies and executable applications from your source code at any point in your during a development cycle. In general, the build process is very similar across many different project types such as Windows, ASP.NET, mobile apps, and others. The build process is also very similar across programming languages such as C#, Visual Basic, C++, and F#.
23+
Running a build creates assemblies and executable applications from your source code at any point during a development cycle. In general, the build process is very similar across many different project types such as Windows, ASP.NET, mobile apps, and others. The build process is also very similar across programming languages such as C#, Visual Basic, C++, and F#.
2424

2525
By building your code often, you can quickly identify compile-time errors, such as incorrect syntax, misspelled keywords, and type mismatches. You can also quickly detect and correct run-time errors, such as logic errors and semantic errors, by frequently building and running debug versions of the code.
2626

docs/vsto/TOC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
##### [Troubleshooting Errors in Office Solutions](troubleshooting-errors-in-office-solutions.md)
151151
##### [How to: Re-enable a VSTO Add-in That Has Been Disabled](how-to-re-enable-a-vsto-add-in-that-has-been-disabled.md)
152152
##### [Additional Support for Errors in Office Solutions](additional-support-for-errors-in-office-solutions.md)
153+
#### [Development best practices for COM, VSTO, and VBA add-ins in Office](development-best-practices-for-com-vsto-and-vba-add-ins-in-office.md)
153154
#### [Threading Support in Office](threading-support-in-office.md)
154155
#### [How to: Read from and Write to Document Properties](how-to-read-from-and-write-to-document-properties.md)
155156
#### [How to: Create and Modify Custom Document Properties](how-to-create-and-modify-custom-document-properties.md)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: "Development best practices for COM, VSTO, and VBA add-ins in Office | Microsoft Docs"
3+
ms.custom: ""
4+
ms.date: "07/25/2017"
5+
ms.reviewer: ""
6+
ms.suite: ""
7+
ms.technology:
8+
- "office-development"
9+
ms.tgt_pltfrm: ""
10+
ms.topic: "article"
11+
dev_langs:
12+
- ""
13+
helpviewer_keywords:
14+
- ""
15+
ms.assetid: 810a6648-fece-4b43-9eb6-948d28ed2158
16+
caps.latest.revision: 33
17+
author: "reezali"
18+
ms.author: "reezali"
19+
manager: "lforman"
20+
---
21+
# Development best practices for COM, VSTO, and VBA add-ins in Office
22+
If you are developing COM, VSTO or VBA add-ins for Office, follow the development best practices described in this article. This will help ensure:
23+
24+
- Compatibility of your add-ins across different versions and deployments of Office.
25+
- Reduced complexity of add-in deployment for your users and IT administrators.
26+
- Unintended installation or runtime failures of your add-in do not occur.
27+
28+
>Note: Using the [Desktop Bridge](https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-root) to prepare your COM, VSTO or VBA add-in for the Windows Store is not supported. COM, VSTO and VBA add-ins cannot be distributed in the Windows Store or the Office Store.
29+
30+
## Do not check for Office during installation
31+
We don’t recommend having your add-in detect whether Office is installed during the add-in installation process. If Office is not installed, you can install the add-in, and the user will be able to access it after Office is installed.
32+
33+
## Use Embedded Interop Types (NoPIA)
34+
If your solution uses .NET 4.0 or later, use embedded interop types (NoPIA) instead of depending on the Office Primary Interop Assemblies (PIA) redistributable. Using type embedding reduces the installation size of your solution, and ensures future compatibility. Office 2010 was the last version of Office that shipped the PIA redistributable. For more information, see [Walkthrough: Embedding Type Information from Microsoft Office Assemblies](https://msdn.microsoft.com/en-us/library/ee317478.aspx) and [Type Equivalence and Embedded Interop Types](https://docs.microsoft.com/en-us/dotnet/framework/interop/type-equivalence-and-embedded-interop-types).
35+
36+
If your solution uses an earlier version of .NET, we recommend that you update your solution to use .NET 4.0 or later. Using .NET 4.0 or later reduces runtime prerequisites on newer versions of Windows.
37+
38+
## Avoid depending on specific Office versions
39+
If your solution uses functionality that is only available in newer versions of Office, verify that the capability exists (if possible, at the feature level) at runtime (for example, using exception handling or by checking the version). Validate minimum versions, rather than specific versions, using supported APIs in the object model, such as the [Application.Version property](https://msdn.microsoft.com/en-us/library/office/microsoft.office.interop.excel._application.version.aspx). We don’t recommend that you rely on Office binary metadata, installation paths, or registry keys because these can change between installations, environments, and versions.
40+
41+
## Enable both 32-bit and 64-bit Office usage
42+
Your default build target should support both 32-bit (x86) and 64-bit (x64), unless your solution depends on libraries that are only available for a specific bitness. The 64-bit version of Office is increasing in adoption, especially in big data environments. Supporting both 32-bit and 64-bit makes it easier for your users to transition between 32-bit and 64-bit versions of Office.
43+
44+
When writing VBA code, use 64-bit safe declare statements and convert variables as appropriate. Additionally, ensure that documents can be shared between users running either 32-bit or 64-bit versions of Office by providing code for each bitness. For more information, see [64-Bit Visual Basic for Applications Overview](https://msdn.microsoft.com/en-us/library/office/gg264421.aspx).
45+
46+
## Support restricted environments
47+
Your solution should not require User Account Elevation or Administrator privileges. Additionally, the solution should not depend on setting or altering:
48+
49+
- The current working directory.
50+
- DLL load directories.
51+
- The PATH variable.
52+
53+
## Change the save location of shared data and settings
54+
If the solution consists of an add-in and a process that is external to Office, do not use the user’s application data folder or the registry to exchange data or settings between the add-in and the external process. Instead, consider using the user’s temporary folder, documents folder, or your solution’s installation directory.
55+
56+
## Increment the version number with each update
57+
Set the version number of the binaries in your solution and increment it with each update. This will make it easier for users to identify changes between versions and assess compatibility.
58+
59+
## Provide support statements for the latest versions of Office
60+
Customers are asking ISVs to provide support statements for their COM, VSTO and VBA add-ins that run in Office. Listing your explicit support statements helps customers using Office 365 ProPlus readiness tools understand your support.
61+
62+
To provide support statements for Office client applications (for example, Word or Excel), first verify that your add-ins run in the current Office release, and then commit to providing updates if your add-in breaks in a future release. You do not have to test your add-ins when Microsoft releases a new build, or an update to Office. Microsoft rarely changes the COM, VSTO and VBA extensibility platform in Office, and these changes will be well documented.
63+
64+
>Important: Microsoft maintains a list of supported add-ins for readiness reports, and ISV contact information. To get your add-in listed, see [https://aka.ms/readyforwindows](https://aka.ms/readyforwindows).
65+
66+
## Use Process Monitor to help debug installation or loading issues
67+
If your add-in has compatibility issues during installation or load, they might be related to issues with file or registry access. Use [Process Monitor](https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) or a similar debugging tool to log and compare behavior against a working environment to help identify the problem.

0 commit comments

Comments
 (0)