Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Metadata Contains a reference that cannot be resolved error

(0) ShareShare
ReportReport
Posted on by 180

Hello,

I have this simple c# console application code...

using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Xrm.Client;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Client.Services;


namespace QueryContact
{
class Program
{
static void Main(string[] args)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
CrmConnection con = new CrmConnection("CRMOnline");
OrganizationService service = new OrganizationService(con);
Guid gid = new Guid("67b46a03-2bad-e811-a964-000d3a3606de");
try
{
Entity account = service.Retrieve("account", gid, new ColumnSet(true));
Console.WriteLine(account.Attributes["name"]);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}

Console.ReadLine();

}
}
}

that throws this error:

Metadata contains a reference that cannot be resolved: 'xxxxxxxxxxx.crm.dynamics.com/.../Organization.svc'.

here is my app.config...

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<connectionStrings>
<add name="CRMOnline" connectionString="Url=xxxxxxxxxxx.crm.dynamics.com; Username=xxxxxxxxx; Password=xxxxxxxxxx;" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Xrm.Sdk" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Xrm.Sdk.Deployment" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Xrm.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

i am sure i was able run such code on 8.2 without any issues. I'm probably getting this issue after the upgrade to 9.0 i think.

Any idea?

thanks!

*This post is locked for comments

  • CRMISKEY Profile Picture
    CRMISKEY 180 on at
    RE: Metadata Contains a reference that cannot be resolved error

    Thanks Rawish!

  • Verified answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Metadata Contains a reference that cannot be resolved error

    Hi,

    I would suggest you to download the latest microsoft crm assembly such as Microsoft.Xrm.Sdk and proxy.

    get them from nuget manager.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans