title: How can I resolve the "Invalid Resx file...Cannot find valid "resheader" tags for the ResX reader and writer type names." compiler error?
body: <p>I'm getting a dozen "Invalid Resx file. ResX input is not valid. Cannot find valid "resheader" tags for the ResX reader and writer type names." err msgs on trying to compile.</p>
  
  <p>I had this problem before, as can be seen <a href="https://stackoverflow.com/questions/19500069/how-can-i-fix-my-invalid-resx-file-input">here</a>.</p>
  
  <p>This time, though, it manifests itself a little differently.</p>
  
  <p>First, here is what I did: I selected the context menu item "Undo Pending Changes" on several files in a project. For each of them, their related *.resx file apparently got corrupted.</p>
  
  <p>2-clicking the first err msg in the Error List takes me here in the .resx file:</p>
  
  <pre><code>  &lt;resheader name="resmimetype"&gt;
      &lt;value&gt;text/microsoft-resx&lt;/value&gt;
    &lt;/resheader&gt;
  </code></pre>
  
  <p>2-clicking the next err takes me here in the .resx file:</p>
  
  <pre><code>&lt;resheader name="resmimetype"&gt;text/microsoft-resx&lt;/resheader&gt;
  </code></pre>
  
  <p>This is a commented out explanatory section; in a little bit of context:</p>
  
  <pre><code>&lt;!-- 
      Microsoft ResX Schema 
  
      Version 1.3
  
      The primary goals of this format is to allow a simple XML format 
      that is mostly human readable. The generation and parsing of the 
      various data types are done through the TypeConverter classes 
      associated with the data types.
  
      Example:
  
      ... ado.net/XML headers &amp; schema ...
      &lt;resheader name="resmimetype"&gt;text/microsoft-resx&lt;/resheader&gt;
      &lt;resheader name="version"&gt;1.3&lt;/resheader&gt;
      &lt;resheader name="reader"&gt;System.Resources.ResXResourceReader, System.Windows.Forms, ...&lt;/resheader&gt;
      &lt;resheader name="writer"&gt;System.Resources.ResXResourceWriter, System.Windows.Forms, ...&lt;/resheader&gt;
      &lt;data name="Name1"&gt;this is my long string&lt;/data&gt;
      &lt;data name="Color1" type="System.Drawing.Color, System.Drawing"&gt;Blue&lt;/data&gt;
      &lt;data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"&gt;
          [base64 mime encoded serialized .NET Framework object]
      &lt;/data&gt;
      &lt;data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"&gt;
          [base64 mime encoded string representing a byte array form of the .NET Framework object]
      &lt;/data&gt;
    . . .
  </code></pre>
  
  <p>All 10 other 2-clickings takes me right to the first line in the .resx file, namely:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p>Hans Passant's answer to the same question by a different cat <a href="https://stackoverflow.com/questions/8390447/c-sharp-resx-file-error">here</a> indicates superfluous white space needs to be removed; I see no such extra white space in my .resx files, though...</p>
  
  <p>What need I do to fix these mangled .resx files?</p>
  
  <h2>UPDATE</h2>
  
  <p>It may be that those first two locations where the err msg seems to point are bogus/misleading; they may be simply places in the files where I had previously put my cursor (odd that the err msg would go there instead of to the supposed location of the problem, though...)</p>
  
  <h2>UPDATE 2</h2>
  
  <p>According to the err msg, the failing *.resx files are missing valid resheader reader/writer tags. Yet those tags/declarations do exist there in the failing *.resx files. These look like this:</p>
  
  <pre><code>  &lt;resheader name="reader"&gt;
      &lt;value&gt;System.Windows.Forms.Design.CFResXResourceReader, System.CF.Design, 
      Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&lt;/value&gt;
    &lt;/resheader&gt;
    &lt;resheader name="writer"&gt;
      &lt;value&gt;System.Windows.Forms.Design.CFResXResourceWriter, System.CF.Design, 
      Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&lt;/value&gt;
    &lt;/resheader&gt;
  </code></pre>
  
  <p>....but, interestingly enough (if you're an uebergeek, anyway) those <em>do</em> differ from the RESX readers and writer declarations in other (compiling) forms, which look like this:</p>
  
  <pre><code>&lt;resheader name="reader"&gt;
  &lt;value&gt;System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, 
      Culture=neutral,PublicKeyToken=b77a5c561934e089&lt;/value&gt;
  &lt;/resheader&gt;
  &lt;resheader name="writer"&gt;
  &lt;value&gt;System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, 
      Culture=neutral,PublicKeyToken=b77a5c561934e089&lt;/value&gt;
  &lt;/resheader&gt;
  </code></pre>
  
  <p>If I replace the RESX reader/writer declarations in the non-compiling forms with the other format (IOW I replace "<em>System.Windows.Forms.Design.CFResXResourceReader, System.CF.Design, Version=7.0.5000.0</em>" with "<em>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0</em>" (and use the differing public key tokens), it compiles!</p>
  
  <p>BUT (and this is a big but[t] (think Bertha)), the machine on which this project is being compiled is a PC (of course), but the target machine on which the .exe will run is a Compact Framework (handheld) device. So, will replacing the "CF" with the more generic RESX verbiage prove problematic once the .exe is moved from point PC to point Handheld Windows CE device?</p>