Adding a reference to an OData service in a C# .NET 4.0 class library

This post describes the steps I took to add a OData Service reference to a C# .NET 4.0 class library.

Description Screendump
Open you’re .NET 4.0 C# class library project in Microsoft Visual Studio 2010  
Right click you’re project in the solution explorer and choose 001
Enter you’re odata service address and click on GO 002
In my case I use basic authentication, so I have to enter my credentials (twice)  

 

 

Screendump 001

image

Screendump 002

image

 

[Unable to load the specified metadata resource.]
I was getting the error [Unable to load the specified metadata resource.].
This can mean many things, but in mine case it was the Entity Framework connection string.

Stacktrace
System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources
System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource..ctor                                  System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader
System.Data.Metadata.Edm.MetadataCache.SplitPaths
System.Data.Common.Utils.Memoizer`2.Result.GetValue
System.Data.Common.Utils.Memoizer`2.Evaluate
System.Data.EntityClient.EntityConnection.GetMetadataWorkspace
System.Data.Objects.ObjectContext..ctor
MyProduct.DAL2.MyProductEntities..ctor