Dynamic CRM 2013 Learning Notes (30) A proxy type with the name account have been defined by another assembly

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.