Wednesday, July 22, 2015

Dynamics GP VS Tools Reference Quirk: Microsoft.Dexterity.Bridge

By Steve Endow

I'm developing a Dynamics GP VS Tools AddIn and noticed an odd behavior.

I was trying to access the Dynamics Globals object properties to get the current company ID and system database name and store it in my Model object.

Controller.Instance.Model.GPCompanyDatabase = Dynamics.Globals.IntercompanyId;
Controller.Instance.Model.GPSystemDatabase = Dynamics.Globals.SystemDatabaseName;

I have these two lines in another project, so I copied them to my current project.


Intellisense recognized Dynamics.Globals and let me choose the two properties, but I was getting an error about type conversion to a string.

Since I have used these exact lines previously, I suspected something wasn't right with my current project.

I had a reference to Application.Dynamics, and I had this using statement:

using Microsoft.Dexterity.Applications;

Since Dynamics.Globals was being picked up by Intellisense, it seemed like my references were okay, but obviously something wasn't quite right.

Another odd thing I noticed was that if I typed a period after SystemDatabaseName or IntercompanyId, I wasn't getting an Intellisense pop up of options.


So something was wrong--clearly Visual Studio wasn't able to determine the data types for those properties.  I was able to use String.Convert to bypass the error, but it bugged me.  It seemed like there was some type of issue with my Application.Dynamics reference.

After checking my other code and trying various things, I finally stumbled across the solution.

I needed to add a reference to Microsoft.Dexterity.Bridge.


Once I added the Bridge reference, Intellisense stopped complaining about the type conversion, and I was able to get Intellisense values for SystemDatabaseName and IntercompanyId.


Only after looking at it again today did I realize that a big clue was staring right at me.


The error was indicating that it was a Dexterity Bridge data type, but I didn't think to look at that detail, and probably only in hindsight was this clue helpful.  But it explains why Bridge is required, and now I know to reference both libraries!

Happy bug hunting!


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter





2 comments:

Vicky said...

Hi Christina ,
I have a same problem , i'm trying to to updater my project from GP2013 to GP2015 once i replace with new dlls ( Application.Dynamics.dll (version :14.0.0.0) and Microsoft.Dexterity.Bridge.dll (version: 14.0.0.0) )
after replace the dlls i rebuild the project then i got lot of issues like below .

Error 28 The type or namespace name 'IDexterityAddIn' could not be found (are you missing a using directive or an assembly reference?)

Error 29 The type or namespace name 'GlTransactionEntryForm' could not be found (are you missing a using directive or an assembly reference?)

Error 24 The type or namespace name 'DynamicsDictionary' does not exist in the namespace 'Microsoft.Dexterity.Applications' (are you missing an assembly reference?)


Error 23 The type or namespace name 'Bridge' does not exist in the namespace 'Microsoft.Dexterity' (are you missing an assembly reference?)


Have any idea why i'm getting these errors , but GP2013 working fine ..

Please help me how to solve this .

Thank you
Victor .A

Steve Endow said...

Hi Victor,

Try changing the .NET Target Profile of your project to .NET 4.5. I believe that GP 2015 requires .NET 4.5.

Let me know if that solves the problem.

Thanks,

Steve Endow