简体   繁体   English

Resx资源,具有相对路径的文件

[英]Resx resource, File with relative path

I'm using a externally managed resx file (non-compiled) via ResXResourceReader. 我正在通过ResXResourceReader使用外部管理的resx文件(未编译)。 I have tried using the file resources with relative paths (to the resx location) as below 我尝试过使用具有相对路径(到resx位置)的文件资源,如下所示

<data name="myfilename" type="System.Resources.ResXFileRef">
<value>..\..\files\a.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>

But it gives error, as file not available. 但由于文件不可用,因此会出现错误。 So how to add the file path as relative? 那么如何将文件路径添加为相对路径呢? Is it should be relative to the application's bin? 它应该相对于应用程序的bin吗?

Thanks to @IronGeek, able to resolve via 感谢@IronGeek,能够通过解析

ResXResourceReader rsxr = new ResXResourceReader(resourcePath); ResXResourceReader rsxr =新的ResXResourceReader(resourcePath); rsxr.BasePath = "basepath" rsxr.BasePath =“基本路径”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM