【问题标题】:Problems with upgrade from a Windows Phone 7.5 project to WP8从 Windows Phone 7.5 项目升级到 WP8 的问题
【发布时间】:2023-03-28 15:40:01
【问题描述】:

我正在尝试维护针对 WP7.5 和 WP8 的两个版本的应用程序。我从 WP7.5 应用程序开始,并添加了带有链接文件的项目副本。然后我通过 Visual Studio 命令将“链接”项目升级到 WP8。当我在模拟器上运行 WP8 应用程序时,它会在执行 MessageBox.Show() 命令时以 System.InvalidOperationException in System.Windows.ni.dll 崩溃。输出窗口在前面提到的错误消息之前显示FileNotFoundException in mscorlib.ni.dll

我尝试将 mscorlib.dll 添加到 WP8 项目,但 VS 告诉我它已被引用。我还尝试在 WMAppManifest 中设置所有功能,如在类似线程中看到的那样,但问题仍然存在。谁能给个提示?

下面是我执行后的输出。我希望你不要介意德国人。

【问题讨论】:

  • 在 WP8 上 MessageBox 在System.Windows.dll 中定义。路径C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0\System.Windows.dll
  • 在构建项目时,是否收到任何警告?另外,您是通过什么方式“链接”这些项目的?
  • 我尝试添加 dll,但它确实出现在之后的引用中,并且添加时没有错误。它只是不起作用......我没有编译器警告,我创建了项目的副本,删除了所有共享文件并通过文件对话框中的“作为链接”选项读取它们。
  • 找到解决方案,也许我应该提到我在 Application_Launching 处理程序中调用MessageBox.Show()...

标签: c# windows-phone-7 windows-phone-8 windows-phone


【解决方案1】:

Windows 8 Windows Phone 8: In Windows Phone 8 if you call Show method from the app Activated or Launching event handlers an InvalidOperationException is thrown with the message Error Displaying MessageBox. Alternatively, you should call the Show method from the Page.OnNavigatedTo(NavigationEventArgs) method.

在 MSDN 中发现,这适用于我的情况。这正是我的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-09
    • 2014-09-21
    • 1970-01-01
    相关资源
    最近更新 更多