Error: Proxy type with the name account has been defined by another assembly

I am a big fan of the Simplified Connection technology added by the Xrm.Client assembly and use it almost exclusively.

Recently, I ran into the same issue at two separate customers. Both had just converted from CRM 4.0 and both had plugins and custom ASP.NET web pages in use.

Occasionally, the following exception would be encountered in either the custom ASP.NET pages or within the plugins:

A proxy type with the name account has been defined by another assembly.

Current type: Account, MyAssembly, Version=, Culture=neutral, PublicKeyToken=be9afbacb707a086,

Existing type: Account, CustomPages, Version=, Culture=neutral, PublicKeyToken=null

Parameter name: account”

The solution was quite simple:

When creating your connection:

var connection = CrmConnection.Parse(connectionString);

set the ProxyTypesAssembly property:

connection.ProxyTypesAssembly = Assembly.GetExecutingAssembly();

That will instruct .NET to use the executing application as the source for Dynamics CRM proxy types.

I hope that saves you some time.

Leave a Reply 2 comments