Metadata contains a reference that cannot be resolved: ‘ttps://MyOrg.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl’
This error comes when running a sample code from Microsoft, in my case I was testing ‘DK\SampleCode\CS\DataManagement\DataImport’ from Sample code but you might come across same error if running ant other sample code, trying to generate ear bounds or any other application trying to connect to D365 API.
If you open one of the sample code and look at the referenced dlls (Microsoft.Xrm.Sdk) you will notice this is v7 (usually restored via NUget).
Remove that referenced dll and add a new reference pointing to latest dll (such as version 18.104.22.168)
Compile application and this time it should work.