码迷,mamicode.com
首页 > 其他好文 > 详细

Xamarin.Forms之Resx

时间:2015-08-14 11:29:33      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

本来使用Resx很简单的事,但是在Xamarin.Studio中遇到问题

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "IWapp.Resx.AppResources.resources" was correctly embedded or linked into assembly "RilevazionePresenze" at compile time, or that all the satellite assemblies required are loadable and fully signed.
[MonoDroid] at System.Resources.ResourceManager.AssemblyResourceMissing (string) 
[MonoDroid] at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo,bool,bool) 
[MonoDroid] at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo,bool,bool) 
[MonoDroid] at System.Resources.ResourceManager.GetString (string,System.Globalization.CultureInfo) 

该问题是命名空间的问题,勾选该选项可能出现这问题:

 

技术分享

解决方法:

如果添加的文件分别是AppResources.resx和AppResources.Designer.cs

AppResources.resx的属性里面的Resource ID

技术分享

和AppResources.Designer.cs里面的(红色部分)

[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GZHB.Resxs.AppResources", typeof(AppResources).GetTypeInfo().Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

一致就不会报错了

 

Xamarin.Forms之Resx

标签:

原文地址:http://www.cnblogs.com/yz1311/p/4729262.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!