如何查看使用ResourceWriter()创建的资源文件?

时间:2017-08-25 16:18:48

标签: c# visual-studio

我测试了一些生成资源文件的代码:

// Creates a resource writer.
  IResourceWriter writer = new ResourceWriter("myResources.resources");

  // Adds resources to the resource writer.
  writer.AddResource("String 1", "First String");

  writer.AddResource("String 2", "Second String");

  writer.AddResource("String 3", "Third String");

  // Writes the resources to the file or stream, and closes it.
  writer.Close();

如何查看文件中保存的内容?我可以使用任何资源查看器吗?

1 个答案:

答案 0 :(得分:1)

看起来您可以使用Visual Studio Tools附带的Resgen.exe(在VS 2010之后)。

打开开发人员命令提示符,然后您可以将.resources文件转换为一堆不同的文件类型,包括.txt

C:\>resgen myResources.resources myResources.txt

将其转换为.txt文件。

但有一点需要注意;

  

如果文件包含非字符串资源(包括文件链接),则转换为.txt会失败

More info here.