Export (0) Print
Expand All

pubCenter Integration with Visual Studio 2013 - Windows 8.1

Microsoft Advertising Services

Updated: April 30, 2014

Published: April 30, 2014

This Windows 8.1 version of the Advertising SDK and Visual Studio 2013 allow developers to interact with the pubCenter web-service using the Visual Studio 2013 IDE.

You can use the Visual Studio 2013 Connected Service Manager to:

  • Create new ad unit IDs

  • Create code for your project that includes the properties necessary to create an AdControl.

You can also manage your ad units by logging into your account on the Microsoft pubCenter website.

Use the Connected Service Manager to Access pubCenter and Create Sample Code


  1. Add the connected service. In the Solution Explorer pane in Visual Studio, right click on the project name, click Add and then in the context menu click Connected Service.

  2. On the Service Manager screen, click Microsoft Ads. In the grid is a message, “You must sign-in to Microsoft Advertising pubCenter to create ad enabled apps."

  3. If you have already signed up with pubCenter, click the Sign In link. If you do not have a pubCenter account, go to http://pubcenter.microsoft.com and sign up for an account. See the topic Windows Advertising for more information.

  4. Log in with your Windows Live ID.

  5. Once you sign in, on the Services Manager screen you can view all the apps associated with your pubCenter account and some ad unit information.

  6. If you have created ad units for an app, on the Services Manager screen you can click on the name of the app to see more details. In the Details section you can see the Application Name and the AdUnit Name and Size

  7. To create an entry for a new app, click on Create Application to create ad units for a new app.

  8. To edit entries, look on the Services Manager screen, click the Configure link to add more ad units.

  9. When you Create or Configure an app, a new window is displayed. Use it to fill the following details: Application Name and Ad Unit information including Name, Size and Recommended Category.

  10. To exit the connected service window, click on Ok.

  11. Information about your ad is written to a text file in your project. The name of the file will be similar to AdSamplePage.xaml.txt for XAML or AdSamplePage.html.txt for JavaScript. Visual Studio will have an entry for the file in Solution Explorer and will open the file in the editor. Sample text for each type of project, XAML or JavaScript, is shown below.

        <StackPanel Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Orientation="Vertical">
        </StackPanel >
    <!DOCTYPE html>
        <meta charset="utf-8">
        <link href="//Microsoft.WinJS.2.0/css/ui-dark.css" rel="stylesheet" />
        <script src="//Microsoft.WinJS.2.0/js/base.js"></script>
        <script src="//Microsoft.WinJS.2.0/js/ui.js"></script>
        <link href="/css/default.css" rel="stylesheet">
        <script src="/js/default.js"></script>
        <script src="/MSAdvertisingJS/ads/ad.js"></script>
        <div id="MyAd_1" style="position: absolute; top: 50px; left: 0px; width: 160px; height: 600px; z-index: 1" 
          data-win-options="{applicationId: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', adUnitId: 'XXXXXXXX'}">

Using Generated Code for Sample Apps

You can use the code from these files in the developer walkthroughs for XAML or JavaScript. However, live ads may not show in the Visual Studio debugger.

Support and Feedback

Get product support or report a bug in the advertising SDK by visiting the Windows Store Apps developer support page support page. For product support, under "App development" click the "Advertising SDK" link. To post a question in the support forum, scroll down to "Find answers online" and click "Ads-in-Apps for Windows 8 forum".

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

Community Additions

© 2014 Microsoft