Skip Navigation LinksHome > Categories > Code from a Category

[CRM 2011] Early bound types and plugins

User Name: ramonbueno
Name: Ramon Bueno
Contact Me:
Home Page:
My blog is focused on Technology and IT. I like to share my experience and problems day by day, I believe it's one of the best ways to learn nowadays. My life is a "earthquake of activity". I can'... [More]
Viewed Times: 2596
Add Date: 09/25/2011
Have you tried to use early bound types in plugins? After run crmsvcutil to generate the early bound types, you probably want to use them in your plugins.

If the generated code is in the same assembly that the plugins, you won’t get any problem.

However, in a medium-big project, you may want to separate common functionality, as business processes or entity wrappers, from the rest.

How are you going to deploy that Common library? Either you can put it in the GAC or merge it with the Plugins assembly. However, as it is, you will get an “Unexpected error” the first time you try to use the IOrganizationService with early bound types inside of your plugins. Example:

To avoid this exception, you should add the next line to AssemblyInfo.cs in your Plugin project
Comment #:  37 Replay this Comment Reply this comment Posted on: 1/24/2012

I noticed that you've referenced more than one assembly in your project.. Are you deploying using the database or on disk method?

Were attempting to do something similar (use multiple assemblies) however the database deployment method is failing; I've attempted to merge using ILMerge,  but I'm forced to reference Microsoft.Xrm.Sdk.dll, which fails to register any Plugins when merged in the final assembly.

If you deploy into the database, can you provide details on how you merged Microsoft.Xrm.Sdk.dll into your project?

We have 5$ going around the office for this fix. Its all yours :) Thanks in advance!

Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.