C# resx 文件错误 [英] C# resx file error

查看:44
本文介绍了C# resx 文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 .resx 文件出现一个奇怪的错误:

I'm getting a weird error with my .resx files:

无效的 Resx 文件.ResX 输入无效.找不到 ResX 读取器和写入器类型名称的有效resheader"标签.C:Documents and SettingsUsersMy DocumentsVisual Studio 2010ProjectsdockWinFormsDockstrings.resx"

"Invalid Resx file. ResX input is not valid. Cannot find valid "resheader" tags for the ResX reader and writer type names. C:Documents and SettingsUsersMy DocumentsVisual Studio 2010ProjectsdockWinFormsDockstrings.resx"

我所做的是用 VS 2008 解决方案中的一些旧文件替换现有 VS 2010 解决方案中的一些文件,大多数文件工作正常,但我收到此错误,我不知道如何修复它.如果它有所作为,这里是该文件的源代码.

What I did was replace some files in an existing VS 2010 solution with some older ones from VS 2008 solution, most of the files work fine but I get this error and I don't know how to fix it. If it makes a difference, here is the source code of that file.

我正在使用 NET WinForms 4.0,如果这很重要的话.

I'm using NET WinForms 4.0, if that matters.

推荐答案

  <resheader name="resmimetype">
    <value>
      text/microsoft-resx
    </value>
  </resheader>

以某种方式添加了额外的空白.您需要将其删除,使其看起来像这样:

Extra white space got added somehow. You'll need to remove it so it looks like this:

  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>

您还必须将程序集引用中的版本号从 2.0.0.0 更新到 4.0.0.0.否则,像这样复制 .resx 文件是陷入困境的好方法.当设计器生成的代码尝试使用 .resx 文件中的缺失值时,您将很容易获得 Darn 的白屏.

You also must update the version numbers in the assembly references from 2.0.0.0 to 4.0.0.0. Copying .resx files like this is otherwise a good way to get into trouble. You'll easily get the White Screen of Darn when the designer generated code tries to use a missing value in the .resx file.

这篇关于C# resx 文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆