c# - 广告在 WP 应用程序中不起作用

标签 c# windows visual-studio xaml windows-phone-8

我正在开发 WP 8/8.1 应用程序。我面临的问题是,当我使用“Adcontrol”工具时,它会在其下方显示一条蓝线,并出现以下错误。

Error    1    The name "AdControl" does not exist in the namespace "clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI".    C:\Users\PraneetSah\Documents\app_3\AppStudio.UI\Views\MainPage.xaml    45    11    AppStudio.UI
Error    2    The type or namespace name 'Advertising' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)    C:\Users\PraneetSah\Documents\app_3\AppStudio.UI\Views\MainPage.xaml.cs    5    17    AppStudio.UI
Warning    3    The referenced component 'Microsoft.Advertising.Mobile' could not be found.     AppStudio.UI
Warning    4    The referenced component 'Microsoft.Advertising.Mobile.UI' could not be found.     AppStudio.UI
Error    5    The type 'ads:AdControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.    C:\Users\PraneetSah\Documents\app_3\AppStudio.UI\Views\MainPage.xaml    45    12    AppStudio.UI

就是这样;我的 SDK/Studios 都安装在默认位置,但我目前正在处理的项目不在默认位置,而是存在于 Documents{custom-folder\... 所以这可能是个问题?或者是其他东西?请帮帮我。以下是我正在使用的 adcontrol 代码(请注意它在下面显示蓝线 广告:广告控制”:

<ads:AdControl Width="480" Height="80"
                  ApplicationId="XXXXXX" AdUnitId="XXXXXX"
                  IsAutoCollapseEnabled="True"
                  IsAutoRefreshEnabled="True"
                  HorizontalAlignment="Center"/>

最佳答案

您需要将广告命名空间添加到 xaml。 Microsoft 示例源代码中应该涵盖了这一点,请查看它们。

关于c# - 广告在 WP 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23391844/

相关文章:

C# - 在不知道它会是什么的情况下初始化一个变量

windows:用于启动程序的命令行

visual-studio - 从 VS 项目中删除资源图像的正确方法是什么?

c# - 解决方案文件夹路径问题中的本地文件

c# - 集群队列的 IBM MQ 问题

c# - 将 JSON 响应流转换为字符串

c# - 格式化字符串/电话号码

c - 从C文件中读取unicode字符

windows - 使用 CFileDialog::AddCheckButton 失败

c# - Visual Studio 2010想要将项目作为类库启动