views:

974

answers:

3

I know the bits just came out today, but one of the first things I want to do with the newly released Windows Mobile 7 SDK is put a map up on the screen and mess around.

I've downloaded the latest version of the Silverlight Maps Control and added the references to my application. As a matter of fact, the VS 2010 design view of the MainPage.xaml shows the map control after adding the namespace and placing the control.

I'm using the provided VS 2010 Express version that comes with the Win Mobile 7 SDK and have just used the New Project -> Windows Phone Application template.

When I try to build I get two warnings related to the Microsoft.Maps.MapControl dll's.

Warning 1 The primary reference "Microsoft.Maps.MapControl, Version=1.0.1.0, Culture=neutral, PublicKeyToken=498d0d22d7936b73, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Windows.Browser, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" which could not be resolved in the currently targeted framework. "Silverlight,Version=v4.0,Profile=WindowsPhone". To resolve this problem, either remove the reference "Microsoft.Maps.MapControl, Version=1.0.1.0, Culture=neutral, PublicKeyToken=498d0d22d7936b73, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Windows.Browser, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e".

Warning 2 The primary reference "Microsoft.Maps.MapControl.Common, Version=1.0.1.0, Culture=neutral, PublicKeyToken=498d0d22d7936b73, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Windows.Browser, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" which could not be resolved in the currently targeted framework. "Silverlight,Version=v4.0,Profile=WindowsPhone". To resolve this problem, either remove the reference "Microsoft.Maps.MapControl.Common, Version=1.0.1.0, Culture=neutral, PublicKeyToken=498d0d22d7936b73, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Windows.Browser, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e".

I'm leaning towards some way of adding the System.Windows.Browser to the targeted framework version. But I'm not even sure if that is possible.

To be more specific; I'm looking for a way to get the Silverlight Maps Control up on a Windows Phone 7 series application. If possible.

Thanks.

+2  A: 

Bing maps control for desktop silverlight is not supported in Windows Phone. You may want to use the BingMapsTask instead.

You're seeing the error because there is no System.Windows.Browser.dll reference for windows phone. If you check the "Add Reference" in Visual Studio 2010 Express, there is no available reference to System.Windows.Browser.dll.

Arun Mahapatra
I'm trying to display a map in my application, not jump to another application (BingMapsTask). If the reference is the problem, can I find the .dll and just reference it straight up instead of relying on the version of the framework to include it?
Jacob
That's a big "no". SL for the phone is not the same a SL for the desktop, so you can't just pull in destop SL controls. Even if you can get them to render in the emulator, they're not going to work on real hardware.
ctacke
no, because the regular version is built against the desktop versions of mscorlib and the other assemblies. The code that runs on the phone is not the same (even though it looks similar from a class library perspective)
Joel Martinez
It seems that it actually does work. I just referenced the System.Windows.Browser.dll file and now the project builds and shows the map in the emulator.
Jacob
it's not going to work when you get real hardware.
ctacke
@ctacke thanks for your unhelpful and extremely speculative expert comments. Of course there is a big possibility that this won't work on an actual phone; for one thing they don't even come out until around Christmas, for another, the SDK was released YESTERDAY. In the meantime, I've got a map on my emulator.
Jacob
+1  A: 

If you add a reference to System.Windows.Browser.dll, usually located in one of the version directories in "C:\Program Files\Microsoft Silverlight" (mine was in C:\Program Files\Microsoft Silverlight\3.0.50106.0), the application will build and you will be able to see the map in the emulator when you run.

The map will move around fine, but the little navigation orb seems to be offset from the corner. Not sure what is going on with that.

There is also a nice write up of getting the map to work at Silverlight Hack

EDIT

As mentioned in other comments. This is probably not going to work on real hardware. But since the real hardware isn't going to be coming out for another 6 months, I figure being able to get something up in the emulator is better than nothing.

Jacob
A: 

You can also look at http://4square.codeplex.com/. It uses the Bing Maps API to pull down map images etc directly, and then work with them in WP7.

CJCraft.com