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:
public class PreCreateContact : BasePlugin { protected override void ExecutePlugin(IOrganizationService service, ITracingService tracingService) { Task newTask = new Task(); newTask.Subject = "Testing"; service.Create(newTask); //Here you will get the error } }
To avoid this exception, you should add the next line to AssemblyInfo.cs in your Plugin project
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
It’s always great to read stuff from the master of coding …