When using LINQ in CRM, this error is sometimes reported:
A proxy type with the name of the account have been defined by another assembly.
Current Type:account, MyAssembly, version=1.0.0.4, Culture=neutral, publickeytoken=be9afbacb707a086,
Existing Type:account, CustomPages, version=1.0.0.0, Culture=neutral, Publickeytoken=null
Parameter Name:account "
Online A search, some people say the solution is simple:
var connection = Crmconnection.parse (connectionString);
Connection. proxytypesassembly = assembly.getexecutingassembly ();
Then to the project, I found there was no such crmconnection:
New "/xrmservices/2011/organization.svc");
New ClientCredentials ();
if "AD")
{
New System.Net.NetworkCredential (Crmusername, Crmuserpassword, crmuserdomainname);
}
Else if "ADFS")
{
Credentials. Username.username = crmuserdomainname + "\ \" + Crmusername;
Credentials. Username.password = Crmuserpassword;
}
New NULL null);
CrmService = (iorganizationservice) crmserviceproxy;
The original is used organizationserviceproxy, so change it to Organizationservice, because organizationservice inside will use this crmconnection:
New ClientCredentials ();
if "AD")
{
New System.Net.NetworkCredential (Crmusername, Crmuserpassword, crmuserdomainname);
}
Else if "ADFS")
{
"\ \" + Crmusername;
Credentials. Username.password = Crmuserpassword;
}
String Server = String. Format ("url={0};D Omain={1}; USERNAME={2}; Password={2} ", Crmserviceurl, Crmuserdomainname, Crmusername, Crmuserpassword);
var connection = crmconnection.parse (server);
Connection. proxytypesassembly = assembly.getexecutingassembly ();
Connection. ClientCredentials = credentials;
New Organizationservice (connection);
New Servicecontext (M_crmservice);
After the change, I will not report this mistake.
Dynamic CRM 2013 Learning Notes Series Rollup-ongoing updates
Dynamic CRM 2013 Learning Notes (30) A proxy type with the name account have been defined by another assembly