EntityPropertyMappingAttribute duplicated between assemblies

October 09, 2013 - net extern-alias jon-skeet odata

I was working on an entity class for an OData endpoint when I ran across the following doozy:

The type 'System.Data.Services.Common.EntityPropertyMappingAttribute' exists in both '...Microsoft.Data.OData.dll' and '...System.Data.Services.Client.dll'

It looks like Microsoft has duplicated this type (plus a couple of others) between two different assemblies - in this instance I ran across it with the Azure.Storage package.

Thankfully, Jon Skeet to the rescue! To resolve:

  1. Select the System.Data.Services.Client reference and open the properties dialog
  2. Under ‘Aliases’, change ‘global’ to ‘global,SystemDataServicesClient’
  3. Add the following code at the top of the offending entity file:
extern alias SystemDataServicesClient; 

using SystemDataServicesClient::System.Data.Services.Common;

You’ll also need to delete your other using System.Data.Services.Common, but at that point you should be compiling again.