Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Unhandled Exception: System.InvalidOperationException: Metadata contains a reference that cannot be resolved

Posted on by 2

Hi,  we recently upgraded to D365 from CRMonline.  We have an webapp that uses CRM webservices SDK to connect to D365 and create new contact and activity. It was working fine until recently that we get an error as below

It appears that we need to upgrade to latest D365 SDK.  Is there any way we can do the code upgrade via some tools? or what is the best way to upgrade.  Our app contains XRM.cs class as well. 

{"Metadata contains a reference that cannot be resolved: 'companyname.crm.dynamics.com/.../Organization.svc'."}

*This post is locked for comments

  • RollingStonzcrm Profile Picture
    RollingStonzcrm 2 on at
    RE: Unhandled Exception: System.InvalidOperationException: Metadata contains a reference that cannot be resolved

    Hi Gopalan,  yes. custom entities are used.  The app was working fine until recent update and its my understanding that some features have been depreciated. 

    my app.conf file 

     <microsoft.xrm.client>
        <contexts>
          <add name="Xrm" type="Xrm.XrmServiceContext, Xrm" connectionStringName="Xrm"/>
        </contexts>
      </microsoft.xrm.client>
      <connectionStrings>
        <add name="Xrm" connectionString="Url=company.crm.dynamics.com; Username=user1; Password=Password-1; authtype=Office365"/>
        
      </connectionStrings>


    The code that I used as below: 

    using (XrmServiceContext orgContext = new XrmServiceContext("Xrm"))
    {
    try
    
                    {
                        var monitor = (from m in orgContext.CreateQuery("custom_entity")
                                       select m).FirstOrDefault();
    }
    }


    From what I understand, I have to use Xrm.Tooling.Connector.CrmServiceClient so I am wondering how could I create the orgContext and leverage the Xrm.cs which is the file I generated for early bound.  In otherwords, what changes do I need to make at app.config file and for the code 

  • Suggested answer
    Gee Bee Profile Picture
    Gee Bee 11,397 on at
    RE: Unhandled Exception: System.InvalidOperationException: Metadata contains a reference that cannot be resolved

    Hi

    If have not added new custom entities, custom fields then you do not need to generate XRM.cs class (early binding types).

    Did you refer the following article:

    rajeevpentyala.com/.../metadata-contains-a-reference-that-cannot-be-resolved

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans