Invalid .resx file after renamed namespace.

Consider the following situation:

  • In my Windows Forms application, I have a form.
  • There is a .resx file in this form.
  • The form uses the class ("OtherClass") from another assembly ("Other.dll").
  • "Other.dll" is built in the same VisualStudio 2010 solution as the main application (only a separate project in the same solution).
  • In the main project (Windows Forms application) I correctly added a link to the project "Other.dll".

Everything works well (as expected).

Now I need to change the namespace of the type contained in "Other.dll", from "Old.Namespace" to "New.Namespace":

  • In VS2010, I will open the "Other.dll" properties window, the project
  • I change the namespace in the Default Namespace text box from Old.Namespace to New.Namespace
  • I am changing the namespaces in the associated .cs files accordingly.
  • I am rebuilding the modified project "Other.dll". No mistakes. The modified file "Other.dll" is created OK.

Now the problem is:

When I rebuild the whole solution after this, the compiler stops and reports that the form's .resx file is invalid:


"Invalid Resx file. Unable to load type Old.Namespace.OtherType, Other, Version 1.0.0.0, Culture = neutral, PublicKeyToken = null, which is used in the .RESX file. Make sure that the necessary links have been added to your project. Line 1521 position 5 "


Obviously, the .resx file is still referencing a type with the old namespace from somewhere. This "somewhere" appears from within the binary section of the .resx file!

Question: How can I make .resx understand that it should now refer to a new type (with a changed namespace)?

Please help, I really don't know how to do this ...

+4
source share
3 answers

I had the same problem and the solution was to delete data sections from resx file

+10
source

I had the same problem too, and after I tried several other options, I followed the Stefania Mereut advice and deleted the data sections from the resx file. When I re-added the resources, he apparently rewrote the data sections correctly.

+2
source

You need to open the resx file manually and change the type name of this binary resource to the new correct type name. I assume that this is a non-standard (i.e. Not a line or image) resource that was manually added to the resx file directly.

I believe that they can only be viewed in the "Other" section of the ResX editor - they cannot be added through it.

0
source

All Articles