C# resx file error

rayanisran picture rayanisran · Dec 5, 2011 · Viewed 12.9k times · Source

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

"Invalid Resx file. ResX input is not valid. Cannot find valid "resheader" tags for the ResX reader and writer type names. C:\Documents and Settings\Users\My Documents\Visual Studio 2010\Projects\dock\WinForms\Dock\strings.resx"

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.

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

Answer

Hans Passant picture Hans Passant · Dec 5, 2011
  <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>

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.