Displaying Ads on Windows Phone 7 apps – The Basics

Microsoft Ads system has made it extremely easy to monetize your Windows Phone 7 Silverlight or XNA apps. In just a few simple steps, you can start displaying contextual ads in your app. In addition, the documentation team has done a tremendous job in writing very detailed and great information. This post has a lot of content copy-pasted from the help file that came with the Ad Control SDK. The purpose of this post is to quickly highlight the major steps you need to follow without going through all the documentation and get up and running as fast as possible. (Thank you again for writing such great content).

There are just 2 simple steps in getting your app up and running with Microsoft Ads:

Download the latest Ad Control SDK from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b0f00afc-9709-4cc2-ba2c-57728db6cbd6 and install it. The current version at the time of this writing is (dated 3/4/2011). Default values for the installation are fine. The latest version of the Ad Control SDK allows you to build your app and show ads in test mode. This ensures that you are productive in less than ½ hour before you need to on-board with pubCenter.

Integrate the AdControl into an Application Using the Visual Studio 2010 Visual Designer. The following steps are a guide for using the Visual Studio 2010 Visual Designer to integrate advertising into Windows Phone 7 applications. In a later tutorial we will discuss how to programmatically add the control to different pages and the best practices surrounding that.



1. Open Visual Studio and create a New Project.

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

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


4. Name the project (for example, AdControlTest) and click OK.

5. In your Visual Studio project, expand the toolbox and right-click Windows Phone Controls. On the context menu, click Add Tab.


6. Under Windows Phone Controls, a new tab will appear and you can enter a name for this tab—for example, WP7AdControl.


7. Right-click the new tab WP7AdControl. On the context menu, click Choose Items ….


8. In the Choose Toolbox Items dialog box, click the Windows Phone Components tab. Click Browse…, and in the Open dialog box, navigate to the location where you installed the Microsoft.Advertising.Mobile.UI.dll previously. Click the Microsoft.Advertising.Mobile.UI.dll file to select it, and then click Open. In the Choose Toolbox Items dialog box, make sure that the check box next to the AdControl Class is selected. Click OK. The AdControl Class will be available in the Toolbox.


9. You should now see the AdControl Class in a new tab.


10. From the new tab, drag and drop the AdControl Class into the Application Designer. Position the AdControl Class so that it is fully visible in the Application Designer.

11. Right-click the AdControl Class in the Application Designer. On the context menu, click Properties.


12. You should now see the AdControl Class Properties panel (on the right hand side).

13. Set the control size either by dragging and dropping the border in the designer or by specifying the size in the Properties panel—for example, Width = 480, Height = 80.


14. In order to receive ads, you will need to register with Microsoft pubCenter. After registration, you will receive an official ApplicationId and AdUnitId to use in the AdControl Class. Before you use the official IDs, you can use test IDs to see how the ads will look in your application. In the Properties panel, configure the following properties:

    1. Set ApplicationId = “test_client”
    2. Set AdUnitId = “Image480_80”


15. Build and run your application and you will see a sample test ad.


In the next post, I will elaborate more on some of the advanced concepts such as Test Values for Windows Phone 7 Silverlight Applications, Test Values for Windows Phone 7 XNA Games, How to display ads on multiple pages, Integrating the AdControl into an Application Programmatically (C#), Best practices, API reference, Disable auto rotation and Demographic targeting – Location, Gender, Income, Birthdate, etc.

Links you should know:

Download Microsoft Advertising SDK for Windows Phone 7

Frequently Asked Questions about the Microsoft Advertising program

Monetization Best Practices for Windows Phone 7 apps

PubCenter for registering your mobile apps


Important Note:

Before you submit your application to the app store, make sure to set the TestMode to false (it’s true by default) and set the correct values for ApplicationId and AdUnitId’s. We will discuss this in the Advanced Concepts post.

Comments (8)

  1. Ron Grant says:

    The downloaded help file (.chm) is static. The documentation online is at:

    msdn.microsoft.com/…/ff973757(v=MSADS.10).aspx and is updated as issues are raised and resolved.

  2. Steve says:

    Does this also work for XNA programs? If so, how do we use this method for XNA. Is it pretty much the same thing?

  3. David says:

    These ads are so annoying how do i disable them so i don't see them in apps?

  4. @David, disabling ads in apps is something that developers can usually do in the code. If there is a paid version of the ad, you might want to consider buying it to avoid seeing the ads.

    As a user, you can disable your network on your mobile for not getting ads

  5. Zach says:

    What happens if the user cannot access the ad because they have no internet? Will a blank ad box appear? Can we prevent this?

  6. Usually, if a user does not have internet, no blank ad box should appear. It tries to connect to the service but when it is not able to connect, the blank ad box dissapears.

  7. gabriel says:

    do you still need to set the testmode to false? I've just implemented this and there's no method called TestMode for Microsoft.Advertising.Mobile.UI.AdControl. Most other posts say you need to this but the posts are from 2010. Has this changed?

  8. Gobind says:

    Can anyone tell me that does developer got paid when user only saw there add and not clicking on those adds banners? And if you have idea please let me know what is the average revenue for developer on 1 advertisement on per view or per click?

Skip to main content