I forget this all of the time, mainly because I’ve only done it 5 times (the number of apps I’ve submitted using the ad control). This is for Silverlight projects only. I haven’t done any XNA on the phone yet, so it might be different.
So, to use the ad control during development:
- Add a reference to Microsoft.Advertising.Mobile.UI.dll to the project and add the AdControl to a page.
- Set the AdModel to Contextual.
- Set the AdUnitId to Image480_80
- Set the ApplicationId to test_client
This is what you should see in Blend when it’s all setup:
Oh, and here’s a tip that will hopefully save someone some time. If you’re adding in the AdControl at the end of your development, make sure you re-run CapabilityDetection to make sure you have all the capabilities you’ll need to display ads.
If you don’t your AdControl will disappear and you’ll see these errors when debugging:
A first chance exception of type ‘System.UnauthorizedAccessException’ occurred in Microsoft.Phone.dll
A first chance exception of type ‘System.UnauthorizedAccessException’ occurred in Microsoft.Phone.dll
‘taskhost.exe’ (Managed): Loaded ‘System.SR.dll’
A first chance exception of type ‘System.IO.DirectoryNotFoundException’ occurred in mscorlib.dll
A first chance exception of type ‘System.IO.IsolatedStorage.IsolatedStorageException’ occurred in mscorlib.dll
‘taskhost.exe’ (Managed): Loaded ‘System.Windows.debug.resources.dll’
A first chance exception of type ‘System.Net.WebException’ occurred in System.Windows.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Windows.dll
A first chance exception of type ‘System.Net.WebException’ occurred in Microsoft.Advertising.Mobile.UI.dll