Answered by:
crm 2011 plug-in won't recognize early bound types

Question
-
Hi,
crm 2011 plug-in won't recognize early bound types if crmsvcutil generated class is referenced as dll in the plug-in.
But if i add the class itself it will work.
I did the Ilmerge as well but it's unable to identify early bound at runtime.
can somebody help??
Padmakar - http://gpadmakar.blogpost.comFriday, June 10, 2011 6:09 AM
Answers
-
Reference assemblies are not supported in CRM (at least officially) and they can always cause headaches, I strongle discourage them. What you can do is include the generated code from crmsvcutil.exe into each of your plugin assemblies and that should work. You can also include this line of code in your plugin assembly (which is included in the generated code):
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
Gonzalo | gonzaloruizcrm.blogspot.com
- Proposed as answer by Gonzalo Ruiz RModerator Friday, June 10, 2011 2:39 PM
- Marked as answer by RhettClintonMVP, Moderator Monday, June 13, 2011 8:30 AM
Friday, June 10, 2011 2:39 PMModerator
All replies
-
Hi, I have exactly the same problem, even trying to deploy that common dll in the GAC... :(
For example, if I try something like this:
=============================================
Contact
c = new Contact();
c.FirstName = "my contact"
;
service.Create(c);
=============================================
It doesn't work and an "Unexpected error" is thrown when service.Create(c) is executed
However, the same with late bound is fine:
Entity e = new Entity("contact");
e.Attributes[
"firstname"] = "my contact";service.Create(e);
Microsoft CRM Developer - Solution Designer http://ramontebar.com
- Edited by Ramón Tébar Bueno Friday, June 10, 2011 8:14 AM more information
Friday, June 10, 2011 8:07 AM -
Friday, June 10, 2011 8:23 AM
-
Reference assemblies are not supported in CRM (at least officially) and they can always cause headaches, I strongle discourage them. What you can do is include the generated code from crmsvcutil.exe into each of your plugin assemblies and that should work. You can also include this line of code in your plugin assembly (which is included in the generated code):
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
Gonzalo | gonzaloruizcrm.blogspot.com
- Proposed as answer by Gonzalo Ruiz RModerator Friday, June 10, 2011 2:39 PM
- Marked as answer by RhettClintonMVP, Moderator Monday, June 13, 2011 8:30 AM
Friday, June 10, 2011 2:39 PMModerator -
Great Gonzalo! It works! I placed
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
in the plugin library and i works fine now.Thank you very much!
Microsoft CRM Developer - Solution Designer http://ramontebar.comFriday, June 10, 2011 4:25 PM -
Friday, June 10, 2011 6:21 PMModerator