Time for my first blog-post.
Update: Everything mentioned here belongs to the new DevCenter of Microsoft, but NOT to Universal Apps for Windows 8.1
Update2: I added information how to solve Error “AM007 We couldn’t add all the required references”
This week I struggled around with the Ads for Windows Store Apps. Microsoft changed the handling of it when they introduced Windows 10.
The Microsoft AdMediator-Control is the Control, that provides the Ads in .Net – as long as you don’t use another 3rd Party thing.
My problem was: I added the control and tried to configure it, like it is described on one of many pages, Microsoft has saved very fragmented in the MSDN: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn864355.aspx.
After I added the control I saw none of the properties, that are described by Microsoft in the example. So I added it by myself. But: What is the ID-Property for? Is it something defined or is it something I can choose by myself? The last question is the correct answer. It is an ID, that is used by your app to identify the Banner. In other Words: it is a second “Name”-Property. But the difference is, that you should never change the ID of that control, because that will break all statistics Microsoft records for you. The Name-Property can be changed at any time.
The next Properties are Width and Height. You need to set them. “Auto” or “*” will not work. The AdMediator Control requires fixed values.
After I finally added the control to the Page, I had to configure the adds. That is really fiddly, but it is also described in the link above. I tried to add the Microsoft-Advertising Service and Smaato. I failed with Smaato. I restarted Visual Studio. No change. Googled a bit: nothing helpful. Finally I figured out, that the resources for the AdProviders are stored in the bin-directory. I closed Visual Studio and deleted the folder. I started Visual Studio and tried it again. It work – Thanks!
I hope now it will work.
After some more weeks I reorganized my projects and solutions. After I did this, my project didn’t build anymore because it cannot find the Namespace “Microsoft.AdMediator.Core.Models” anymore. I checked the references and the message was correct: My AdMediator-Assemblies were gone. Only the References for the Smaato-Provider were still present. In the “Connected Service…”-Dialog the Microsoft Advertisment network was in status “Not Fetched”. When I tried to readd it (removed and add again) I got the Error “AM007 We couldn’t add all the required references. (…)”.
First I tried the solution above, but it didn’t worked.
The final solution for me was:
1. Remove everything related to the AdMediator from your project. References, usings, XML-Namespaces in the xaml-Files, Methods, Events etc.
2. Build your project until it runs without the AdMediator
3. Close Visual Studio
4. Go the the folder were your NuGet-Packages are stored. The folder is named “packages” and is usually next to your Solution-File (*.sln). Delete everything related to the AdMediator, AdDuplex and Smaato. If you are not sure, you can also delete the whole folder, but then the missing libraries have to be downloaded again.
5. Go to your project-folder and delete the bin- and obj-folder
6. Open the package.config in your project-folder with a text-editor. If there is anything related to AdMediator, AdDuplex or Smaato, delete it.
7. Open your Solution again in Visual Studio. Go to the Designer and Drag’n’Drop the AdMediator-Control (not the “AdControl”!). The AdMediator-Control was at the bottom of the Toolbox for me.
8. Configure your control as it was before. If you just comment old control out, you can replace the Drag’n’Drop-Created code by your old one.
9. Check if your project builds (it should)
10. Right Click “References” in the Solution Explorer and select “Add” -> “Connected Service…”. Select “Ad Mediator” and click configure. There should be a “Fetched” now next to “Microsoft Advertising”.
11. Configure your “Microsoft Advertising”-Network by click on the “configure” link. If you are done, click “Add” (but it is more like “OK”).
12. Check if your project builds (it should)
13. Open the Ad Mediator configure dialog again and add the Smaato-Network. It should download the Smaato Libraries and finally results in a “Fetched” too. Don’t forget to configure Smaato after this.
14. Repair everything you destroyed in Step 1 and you are done.
15. If you change the Id of the AdMediator-Control in Step14 (or after configuring any network), you have to open the “Connected Service”-Dialog to Update this in the Ad-Config. If you not open the “Connected Service”-Dialog again, you a Debug-Output in the Output-Window like “Exception thrown: ‘System.NullReferenceException’ in Microsoft.AdMediator.Windows81.MicrosoftAdvertising.DLL”
Some more things @Microsoft:
1. Please provide something like a Quick-Start-Documentation INCLUDING the part in the Developer Dashboard. Don’t fragment it over many sites. In the fragmented ones, you can be more detailed – more that it is now!
2. Where can I control the size of the Ads you provide me in the Developer Dashboard?
3. Where can I configure what kind of Ads I like to see? I also wish a Blacklist for companies, that are offering some things to win, if I answer some questions. I don’t want them.
Originally posted on August 20th 2015