Windows Phone 8.0 Silverlight Apps -- Integrating the AdControl Using the Visual Designer

Windows Phone 8.0 Silverlight Apps -- Integrating the AdControl Using the Visual Designer

Updated: April 1, 2014

Published: April 2, 2014

The following steps are a guide to using the Visual Studio 2012 Visual Designer to integrate advertising into apps targeting Windows Phone 8.0.

Integrate an AdControl into an App Using the Visual Studio 2012 Visual Designer

  1. Open Visual Studio and create a new project.

  2. From the installed templates section (on the left), expand Visual C# and click Windows Phone.

  3. Select the type of application you are building—for example, Windows Phone App.

    New Project Dialog in Visual Studio 2012

  4. Name the project (for example, AdControlTest) or accept the default name and click OK.

  5. Next, you will need to verify and add the required capabilities to your app.

    In the Solution Explorer panel, open the Properties node. Then double click WMAppManifest.xml.

    VS2012 Solution Explorer

  6. Click the Capabilities tab. In this panel, make sure the ID_CAP_IDENTITY_USER, ID_CAP_MEDIALIB_PHOTO, and ID_CAP_PHONEDIALER are checked. If not, add those by clicking on the check box. Do not uncheck the other capabilities, your app will not run if you do.

    VS2012 Capabilites Tab

    System_CLiX_note Note

    The addition of required capabilities for seeing test ads in the emulator is new with updated versions of Visual Studio 2012. Older versions may not have required this step to run. Follow these steps to double-check you have the required capabilities.

  7. In the Toolbox, you will see the AdControl in the Windows Phone Controls tab.

    VS2012 Toolbox

  8. Drag and drop the AdControl into the Application Designer. Position the AdControl so that it is fully visible in the Application Designer.

    Drag and Drop AdControl

    If you look at the code behind file for the page hosting the AdControl, you can see the code inserted by the AdControl.

  9. Expand the AdControl properties in the Visual Studio Properties panel.

    Visual Studio 2012 AdControl Properties

  10. Take a moment to examine the AdUnitId and ApplicationId properties. By default the following properties are set to the following values.

    1. AdUnitId is Image480_80.

    2. ApplicationId is test_client.

    To receive live ads on a device you will replace these values with the values for your app id and ad unit id from Microsoft pubCenter. For more information about test values, see Test Values for AdUnitId and ApplicationId.

  11. Run your application and you will see a sample test ad.

    Run your code and the AdControl shows

    System_CLiX_note Note

    It may take several minutes, depending on the speed of your machine, for the emulator to load and then for the application to be deployed. Once the app is deployed you will see the sample test ad in a sample app. Watch the text in the Visual Studio 2012 Status Bar to see the progress.

Live ads will not display in the emulator.

In order to receive live ads in the app you submit to the store you will need to replace the test values of the AdControl with the live values from pubCenter. For more information, see Getting Access to Microsoft pubCenter and Receiving Ads.

Support and Feedback

Get product support or report a bug in the product by visiting the Windows Phone Dev Center support page (scroll down to the section "Microsoft Advertising support").

Send feedback about this documentation to There is no product support through this alias. Documentation feedback only.

Community Additions

© 2016 Microsoft