Sdílet prostřednictvím


Specifying supported clients

By default, an integration created with Visual Studio Tools will operate in the Microsoft Dynamics GP desktop client. The integration will not operate in the Microsoft Dynamics GP web client by default, because often some additional work must be done to support the web client.

As part of developing your integration, you should specify which client types are supported by the integration. The Microsoft Dynamics GP runtime will use this information to determine whether or not to load the integration when Microsoft Dynamics GP is started. There are two ways to specify the client types supported: using an attribute in the code and using the Dynamics.exe.config file.

Using an attribute

The preferred way of specifying which client types are supported is to add the SupportedDexPlatforms attribute to the class that implements the IDexterityAddIn interface. The SupportedDexPlatforms attribute takes one parameter that indicates with platform or platforms are supported by the integration. When Microsoft Dynamics GP is started, the DLLs in the AddIns folder are examined for this attribute. Each add-in is loaded based on the attribute setting.

In the following C# example, the logical-or operation is used to indicate that both the desktop client and the web client are supported.

namespace CSharpSample
{
    [SupportedDexPlatforms(DexPlatforms.DesktopClient |
        DexPlatforms.WebClient)]
    public class GPAddIn : IDexterityAddIn
    {
        // IDexterityAddIn interface
        public void Initialize()
        {
        }
    }
}

The following Visual Basic example shows how to enable a Visual Basic integration for both the desktop client and the web client. In this example, the logical-or operation is used to indicate that both the desktop client and the web client are supported.

<SupportedDexPlatforms(DexPlatforms.DesktopClient Or DexPlatforms.WebClient)>
Public Class GPAddIn
    Implements IDexterityAddIn

    ' IDexterityAddIn interface
    Sub Initialize() Implements IDexterityAddIn.Initialize

    End Sub

End Class

Using the Dynamics.exe.config file

You can also use the Dynamics.exe.config file to register the add-ins to be loaded. This configuration file contains sections that indicate which Visual Studio Tools add-ins are loaded for the desktop client, GP utilities, and the web client. The assemblies for the Visual Studio Tools add-ins are placed directly into the main folder of the Microsoft Dynamics GP installation. You would add an entry for your add-in to the appropriate section, based on when you want your add-in to be loaded. This is how Visual Studio Tools add-ins that ship with Microsoft Dynamics GP are loaded. The full syntax to use for the entry is found in the Dynamics.exe.config file.

As an example, the following entry will load the FieldDefaulter sample add-in:

<addin name="FieldDefaulter" type="FieldDefaulter.GPAddIn,FieldDefaulter"/>