During some point in your GP Add-In building career, you might come across the following errors:
- “Type ‘IDexterityAddIn’ is not defined”
- “’Dynamics’ is not declared. It may be inaccessible due to its protection level.”
Even after setting your class’s security level to public, you may still receive the same error messages. Looking through your import statements, you see your Microsoft.Dexterity.Bridge import statement underlined with red. Hovering over the statement will display an alarming error message that reads:
“Namespace or type specified in the Imports ‘Microsoft.Dexterity.Bridge doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.”
Even after checking that project does in fact include a reference to the proper Microsoft.Dexterity.Bridge .dll, you still receive errors appears despite everything appearing to be set up correctly. However, one easily overlooked step in all of this is making sure the .NET framework is set to the correct version. This is what fixed these issues for me when I encountered them. I was building a GP Add-In for Dynamics GP 2015 and my GP references looked like so:
However, my project’s target framework was set to .NET Framework 4.0. Once I changed it to .NET Framework 4.5.1 and rebuilt the solution, the errors no longer appeared. Of course, the target .NET Framework should be changed to a version compatible with your .dll’s version and, consequently, the version of GP your GP Add-In targets.
This article was written by Kevin Huynh, Dynamics GP Technical Consultant for Tridea Partners. Tridea is a leading Microsoft Dynamics provider serving CA, AZ, UT, CO, New England and surrounding regions.