#SBA: Getting Visual Studio Tools Addins working in Service Mode

David Meego - Click for blog homepageI recently had issues with one of my products and need to share the cause of the issue and the solution with the Microsoft Dynamics GP development community.

I made changes to all my products late last year, introducing a new registration system. The code uses Visual Studio Tools for Microsoft Dynamics GP addin DLLs written in Visual C# to handle all the communication with the appropriate registration server.

Everything worked perfectly in Desktop mode and even in Web Client mode, but I was having issues with my registration code failing in Service mode and my products becoming unregistered.

Both the GP Power Tools and Batch Posting Service Toolkit products have service procedures which are exposed as Service Based Architecture Web Services.

After some testing and the addition of some logging code to confirm where the registration system was failing, I was able to determine that the addin DLL was not getting loaded when the Dexterity runtime engine was in Service mode.

An initial workaround involved copying the addin from the Addins folder into the application folder and modifying the Dynamics.exe.config file. This worked but was inelegant and not the preferred solution.

When you see the solution below, you will have one of those “Aha” moments….

You remember how we needed to add a line for SupportedDexPlatforms to make code work in Web Client Mode. If not, see the article below:

Well, there is an undocumented additional setting to make code work in Service Mode. See the examples below with the additional DexPlatform.Service option (you will need to scroll to the right in the code samples):

Visual C# code sample

namespace CSharpSample
    [SupportedDexPlatforms(DexPlatforms.DesktopClient | DexPlatforms.WebClient | DexPlatforms.Service)]
    public class GPAddIn : IDexterityAddIn
        // IDexterityAddIn interface

        public void Initialize()

Visual Basic .Net code sample

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

    ' IDexterityAddIn interface

    Sub Initialize() Implements IDexterityAddIn.Initialize

    End Sub

End Class

Now the addins were loaded and my code worked as expected.

Hope this is helpful.


This article was originally posted on http://www.winthropdc.com/blog.

2 thoughts on “#SBA: Getting Visual Studio Tools Addins working in Service Mode

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.