具有.resx资源的Windows Phone 8.1上的MissingManifestResourceException [英] MissingManifestResourceException on Windows Phone 8.1 with .resx resources

查看:117
本文介绍了具有.resx资源的Windows Phone 8.1上的MissingManifestResourceException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Windows Phone 8.1应用程序,该应用程序也针对Android(Xamarin)

I'm developing a Windows Phone 8.1 app that also targets Android(Xamarin)

我曾经在PCL上添加了字符串资源(.resx)并引用了它们在我的启动器项目上使用以在我的视图上使用,这一切在WP 8.1 silverlight上都可以正常工作,但在将项目配置为在设备上发布并运行它时,在WinRt上运行,由于某种原因,我总是会得到MissingManifestResourceException。我已经尝试了解决此问题的所有解决方案,但均未成功。

As ever I added my string resources(.resx) on a PCL and referenced them on my launcher project to use it on my views, this all works fine on WP 8.1 silverlight but on the WinRt when I configure the project to release and run it on a device, for some reason I always get a MissingManifestResourceException. I've tried every solution for this problem out there without any success.

请注意,在模拟器上,一切正常,当解决方案配置器设置为调试时,它也可以正常工作在设备和仿真器上。

Note that on the emulator everything works fine, when the solution configurator is set to Debug it also works on both device and emulator. The only combination here is device and Release.

应用程序源代码位于 Github

我能够创建一个简单的项目来复制此问题,基本上它是WP 8.1应用程序和具有嵌入式资源的PCL项目,下载链接

I was able to create a simple project to replicate this issue, basically it is a WP 8.1 app and a PCL project with the embedded resources, Download Link

有人有什么想法吗?

编辑:在进行了更多测试之后,我尝试运行一个旧的Windows 8.1应用程序,该应用程序使用相同的本地化模型并且出现了相同的问题,因此,它似乎是一个工具问题,而不是配置问题,因为Windows 8.1应用程序已上市,并且一切正常。

After making some more testing I tried running an old Windows 8.1 app that I've done with the same localisation model and the same issue appeared so it seams to be a tool issue and not a configuration issue, since the Windows 8.1 app is on the market and everything went fine back there.

推荐答案

我们的团队遇到了类似的问题,并得到了跟踪到运行时,而不是PCL,WinRT组件或应用程序包。也就是说,资源存在于PCL程序集中,应用程序包的resources.pri文件中,但在运行时找不到。

Our team ran into a similar issue which was tracked down to the runtime and not the PCL, WinRT component, or application package. That is, the resources exist within the PCL assembly, within the application package resources.pri file, but just cannot be found at runtime.

有一个活动的Microsoft Connect报告此处:

There is an active Microsoft Connect report here:

https://connect.microsoft.com/VisualStudio/feedback/details/991028/issue-using-resx-files-on-winrt-apps-windows-phone-and -windows

我们的解决方法是将WinRT组件注入到每个引用PCL的每个生成的Resources类中,我们自己的派生ResourceManager将调用重定向到WinRT而是使用ResourceLoader。我写了一篇博客文章,描述了解决方法:

Our workaround was for the WinRT component to inject into each generated Resources class of each referenced PCL our own derived ResourceManager which redirected the call to the WinRT ResourceLoader instead. I've written a blog post that describes that workaround:

http://blogs.msdn.com/b/philliphoff/archive/2014/11/19/missingmanifestresourceexception-when-using -portable-class-libraries-in-winrt.aspx

这篇关于具有.resx资源的Windows Phone 8.1上的MissingManifestResourceException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆