首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从Mac上的Monodevelop内的.Resx文件中获取字符串值

无法从Mac上的Monodevelop内的.Resx文件中获取字符串值
EN

Stack Overflow用户
提问于 2013-01-17 04:31:40
回答 1查看 893关注 0票数 0

从这个问题可以看出:

C#, Localization, Resources, and MonoDevelop

在答案部分,它说:

“通常的做法是在项目中以.resx格式存储资源,MonoDevelop会在构建项目时自动将它们编译成.resources文件(你必须手动编译.txt文件)。不幸的是,MD没有专门的编辑工具来编辑resx文件,所以你必须直接编辑这些文件。”

我有一个应用程序,工作在视窗与vs2008。

我正在尝试将它移植到Mac OSX上。

我有一个包含不同字符串的.resx文件。

当我使用:

Resources.Properties.Resources.Distributor_ARDL

我得到了:

代码语言:javascript
复制
 {System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.OverflowException: Number overflow.   at (wrapper managed-to-native) object:\_\_icall\_wrapper\_mono\_array\_new\_specific (intptr,int)   at System.Drawing.Icon.InitFromStreamWithSize (System.IO.Stream stream, Int32 width, Int32 height) [0x00000] in :0    at System.Drawing.Icon..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext context) [0x00000] in :0    at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)   at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0    --- End of inner exception stack trace ---   at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0    at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingContext context) [0x00000] in :0    at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00000] in :0    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] in :0    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in :0    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in :0    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in :0    at System.Resources.ResourceReader.ReadNonPredefinedValue (System.Type exp\_type) [0x00000] in :0    at System.Resources.ResourceReader.ReadValueVer2 (Int32 type\_index) [0x00000] in :0    at System.Resources.ResourceReader.LoadResourceValues (.ResourceCacheItem[] store) [0x00000] in :0    at System.Resources.ResourceReader+ResourceEnumerator.FillCache () [0x00000] in :0    at System.Resources.ResourceReader+ResourceEnumerator..ctor (System.Resources.ResourceReader readerToEnumerate) [0x00000] in :0    at System.Resources.ResourceReader.GetEnumerator () [0x00000] in :0    at System.Resources.ResourceSet.ReadResources () [0x00000] in :0    at System.Resources.ResourceSet.GetObjectInternal (System.String name, Boolean ignoreCase) [0x00000] in :0    at System.Resources.ResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in :0    at System.Resources.RuntimeResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in :0    at System.Resources.ResourceSet.GetStringInternal (System.String name, Boolean ignoreCase) [0x00000] in :0    at System.Resources.ResourceSet.GetString (System.String name, Boolean ignoreCase) [0x00000] in :0    at System.Resources.ResourceManager.GetString (System.String name, System.Globalization.CultureInfo culture) [0x00000] in :0    at Imaginality.Resources.Properties.Resources.get\_Distributor\_ARDL () [0x00000] in 

所以我想知道resx文件是否工作正常。

如果其他人在这个问题上有任何运气的话。

resx的build选项设置为embeddedresouce。

EN

回答 1

Stack Overflow用户

发布于 2013-02-05 10:53:17

嗨,在胡乱摆弄之后,我发现mono不喜欢我创建的几个.icon文件。到目前为止,我不确定它不喜欢什么(因为它喜欢8个文件中的3个),所以一旦我删除了文件,它就可以很好地构建。由于错误与图标文件无关,只是第一次调用资源文件时出现错误,所以花了一些时间才弄清楚它们是什么。干杯

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14367272

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档