Using Bing Maps in a Windows 8 Metro style app
It's also easy enough to use Bing Maps in an application from scratch. First add a Reference to Bing Maps for C#, C++, or Visual Basic (Beta) and Microsoft Visual C++ Runtime Package (if you're writing a managed app, C++ only needs Bing Maps).
If you try to build at this point you'll be presented with a most confusing set of error messages:
- Could not find SDK "Microsoft.VCLibs, Version=11.0".
- "APPX" attributes were found in the SDK manifest file however none of the attributes matched the targeted configuration and architecture and no "APPX" attribute without configuration and architecture could be found. If an appx is required then the project will fail at runtime.
- The referenced component 'Microsoft Visual C++ Runtime Package' could not be found.
Don't be alarmed. This just means you're writing a managed application and have left the platform target at the default Any CPU and both Bing Maps and Visual C++ Runtime require a specific architecture to be set. Change the Active solution platform to x64 or x86 and then it will build properly. The Visual C++ Runtime package is required to deploy on computers that do not have Visual Studio installed. To use the Map control you can drag it from the Toolbox and drop it on your page or declare it yourself with the following two snippets:
<bm:Map Width="800" Height="600" Credentials="INSERT_YOUR_BING_MAPS_KEY" />
You will need a Bing Maps Key to use the map but fortunately we have generous pre-release licensing terms that permit you to use it for free during the beta period. You can read more the licensing terms on the Bing Maps blog. For digging deeper we have also worked hard to make sure the documentation is helpful and up to date.