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

Steps

  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.

    <Page
        x:Class="My_Ad_Funded_Windows_XAML_App.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:TestAdApp"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:UI="using:Microsoft.Advertising.WinRT.UI"
        mc:Ignorable="d">
    
        <StackPanel Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Orientation="Vertical">
            <UI:AdControl 
                ApplicationId="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" 
                AdUnitId="XXXXXXXX" 
                Width="160"
                Height="600" 
                HorizontalAlignment="Left" 
                VerticalAlignment="Top"/>
    
        </StackPanel >
    </Page>
    
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>My_Ad_Funded_Windows_JS_App</title>
    
        <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>
    
    </head>
    <body>
    
        <div id="MyAd_1" style="position: absolute; top: 50px; left: 0px; width: 160px; height: 600px; z-index: 1" 
          data-win-control="MicrosoftNSJS.Advertising.AdControl" 
          data-win-options="{applicationId: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', adUnitId: 'XXXXXXXX'}">
        </div>
    
    
    </body>
    </html>
    

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

ADD
Show:
© 2014 Microsoft