How to add open street maps/Google/Bing maps as background layer to my sharpmap map

Topics: SharpMap v0.9 / v1.x
Aug 10 at 10:08 AM
Edited Aug 10 at 10:44 AM
I'd like to add Open Street Map/ Google Maps/ Bing Maps (Any map will do) as a background layer to my Sharpmap map.

So far I've achieved this in windows forms but I need this in a web Asp .Net, C# web site.

I found a direction to achieve this here

How ever I'm experiencing error stating that
The best overloaded method match for 'SharpMap.Layers.TileLayer.TileLayer(BruTile.ITileSource, string)' has some invalid arguments
Argument 1: cannot convert from 'BruTile.Web.BingTileSource' to 'BruTile.ITileSource'
The code used in my aspx.cs file is as below and the error occurs in the var Layerbing line.
 var ShapeDataProvider = new SharpMap.Data.Providers.ShapeFile(@"Local shp Path");

    var layer = new VectorLayer("test");
    layer.DataSource = ShapeDataProvider;
  var layerbing = new TileLayer(new BingTileSource(BingRequest.UrlBing, "", BingMapType.Aerial), "TileLayer");
    _map.Layers.Add(layerbing);
    _map.Layers.Add(layer);
   
I'm using sharpmap 1.1.0 with Brutile 0.7.4.4

Any help is much appreciated. Thanks in advance. Cheers!
Coordinator
Aug 11 at 7:41 AM
I assume you have some assembly version mismatch.
Aug 12 at 4:30 AM
FObermaier,

Thanks for replying, I'm using below in my project
 Sharpmap    1.1.0.0
 Brutile     0.7.4.4
 ProjNet     1.3.0.3
 NetTopologySuite  1.13.2.0
 GeoAPI   1.7.2.0
I used nuget to add the above, If this of any help to identify my error.

Can you share me a piece of code which works in accessing OpenStreetMap as background layer?
that'll be a life-saver.

Thanks again for replying.. Cheers!
Coordinator
Aug 12 at 8:51 AM
Edited Aug 12 at 8:52 AM
There is absolutely nothing wrong with your code.
What kind of framework are you targeting. You should have it set to .Net40 (Client).
Maybe manually cleaning the output folder will help resolve your issue, too.
Aug 17 at 7:04 AM
Edited Aug 17 at 7:06 AM
Thanks FObermaier,
I removed all the references and added again from scratch from Nuget; now it works like a charm. Previously I was targeting .Net 4 and now I'm using .Net 4.5 with sharpmap 1.1 and BruTile 0.7.4.4 
Thanks for helping. Cheers!