Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

I had this problem before, as can be seen here.

This time, though, it manifests itself a little differently.

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.

2-clicking the first err msg in the Error List takes me here in the .resx file:

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

2-clicking the next err takes me here in the .resx file:

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

This is a commented out explanatory section; in a little bit of context:

<!-- 
    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 & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">1.3</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1">this is my long string</data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        [base64 mime encoded serialized .NET Framework object]
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        [base64 mime encoded string representing a byte array form of the .NET Framework object]
    </data>
  . . .

All 10 other 2-clickings takes me right to the first line in the .resx file, namely:

<?xml version="1.0" encoding="utf-8"?>

Hans Passant's answer to the same question by a different cat here indicates superfluous white space needs to be removed; I see no such extra white space in my .resx files, though...

What need I do to fix these mangled .resx files?

UPDATE

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...)

UPDATE 2

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:

  <resheader name="reader">
    <value>System.Windows.Forms.Design.CFResXResourceReader, System.CF.Design, 
    Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </resheader>
  <resheader name="writer">
    <value>System.Windows.Forms.Design.CFResXResourceWriter, System.CF.Design, 
    Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </resheader>

....but, interestingly enough (if you're an uebergeek, anyway) those do differ from the RESX readers and writer declarations in other (compiling) forms, which look like this:

<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, 
    Culture=neutral,PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, 
    Culture=neutral,PublicKeyToken=b77a5c561934e089</value>
</resheader>

If I replace the RESX reader/writer declarations in the non-compiling forms with the other format (IOW I replace "System.Windows.Forms.Design.CFResXResourceReader, System.CF.Design, Version=7.0.5000.0" with "System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0" (and use the differing public key tokens), it compiles!

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
904 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...