本来使用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; } }
一致就不会报错了