473,795 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error : Invalid Resx file

487 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1. Assembly assembly = Assembly.GetExecutingAssembly();
  2. ResourceManager rm = new ResourceManager("NameSpace.Demo", assembly, null);
  3.             try
  4.             {
  5.                 logo.Image = (Image)rm.GetObject("WroxLogo");
  6.                 textTitle.Text = rm.GetString("Title");
  7.             }
  8.             catch (Exception ex)
  9.             {
  10.                 MessageBox.Show(ex.Message.ToString());
  11.             }
Hi, I created a Demo.resx and I included it to my project, when I try to compile it showing.
Error :Invalid Resx file. Invalid character in the given encoding. Line 1, position 1. <File Path>\Demo.resx
Can any one explain why this error is occurring and how to rectify it?

Front-end : C# 2005
Nov 7 '07 #1
5 15891
Plater
7,872 Recognized Expert Expert
Umm, resx files look NOTHING like that.
Are you sure you don't want a new class file?

This is an example of a resx file:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <root>
  3. <!-- 
  4.     Microsoft ResX Schema 
  5.  
  6.     Version 2.0
  7.  
  8.     The primary goals of this format is to allow a simple XML format 
  9.     that is mostly human readable. The generation and parsing of the 
  10.     various data types are done through the TypeConverter classes 
  11.     associated with the data types.
  12. -->
  13.   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  14.     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
  15.     <xsd:element name="root" msdata:IsDataSet="true">
  16.       <xsd:complexType>
  17.         <xsd:choice maxOccurs="unbounded">
  18.           <xsd:element name="metadata">
  19.             <xsd:complexType>
  20.               <xsd:sequence>
  21.                 <xsd:element name="value" type="xsd:string" minOccurs="0" />
  22.               </xsd:sequence>
  23.               <xsd:attribute name="name" use="required" type="xsd:string" />
  24.               <xsd:attribute name="type" type="xsd:string" />
  25.               <xsd:attribute name="mimetype" type="xsd:string" />
  26.               <xsd:attribute ref="xml:space" />
  27.             </xsd:complexType>
  28.           </xsd:element>
  29.           <xsd:element name="assembly">
  30.             <xsd:complexType>
  31.               <xsd:attribute name="alias" type="xsd:string" />
  32.               <xsd:attribute name="name" type="xsd:string" />
  33.             </xsd:complexType>
  34.           </xsd:element>
  35.           <xsd:element name="data">
  36.             <xsd:complexType>
  37.               <xsd:sequence>
  38.                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
  39.                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
  40.               </xsd:sequence>
  41.               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
  42.               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
  43.               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
  44.               <xsd:attribute ref="xml:space" />
  45.             </xsd:complexType>
  46.           </xsd:element>
  47.           <xsd:element name="resheader">
  48.             <xsd:complexType>
  49.               <xsd:sequence>
  50.                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
  51.               </xsd:sequence>
  52.               <xsd:attribute name="name" type="xsd:string" use="required" />
  53.             </xsd:complexType>
  54.           </xsd:element>
  55.         </xsd:choice>
  56.       </xsd:complexType>
  57.     </xsd:element>
  58.   </xsd:schema>
  59.   <resheader name="resmimetype">
  60.     <value>text/microsoft-resx</value>
  61.   </resheader>
  62.   <resheader name="version">
  63.     <value>2.0</value>
  64.   </resheader>
  65.   <resheader name="reader">
  66.     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  67.   </resheader>
  68.   <resheader name="writer">
  69.     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  70.   </resheader>
  71. </root>
  72.  
Nov 7 '07 #2
CyberSoftHari
487 Recognized Expert Contributor
Thank you plater.
Expand|Select|Wrap|Line Numbers
  1.           ResourceWriter rw = new ResourceWriter("Demo.resx");
  2.           using (Image image = Image.FromFile("logo.gif"))
  3.           {
  4.              rw.AddResource("WroxLogo", image);
  5.              rw.AddResource("Title", "Professional C#");
  6.           }
Actually, I am encoding a .gif file and created a resx file through code then referred(Added) to my project.
I am unable to understand the concept of ‘Resource writer’, ‘Resource Reader’, and ‘Resource Manager’. Can any one give some simple example to understand the concept (and if you have time please give with explanation)?
Thank you.
Nov 12 '07 #3
CyberSoftHari
487 Recognized Expert Contributor
I am getting this Exception..

"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"Demo.resource s\" was correctly embedded or linked into assembly \"NameSpace\ " at compile time, or that all the satellite assemblies required are loadable and fully signed."

Till i am trying...

Changed the Code like

ResourceManager rm = new ResourceManager ("Demo", Assembly.LoadFi le(@"filePath/Demo.resources" ));

Now, Here i am getting error
Attached Images
File Type: jpg Error_80131018.JPG (17.8 KB, 591 views)
Nov 12 '07 #4
CyberSoftHari
487 Recognized Expert Contributor
My AssemblyVersion is
Expand|Select|Wrap|Line Numbers
  1. [assembly: AssemblyVersion("1.0.0.0")]
  2. [assembly: AssemblyFileVersion("1.0.0.0")]
I am Creating Resource file
Expand|Select|Wrap|Line Numbers
  1.       ResourceWriter rw = new ResourceWriter("Demo.resources");  
  2.           using (Image image = Image.FromFile("logo.gif"))
  3.           {
  4.              rw.AddResource("WroxLogo", image);
  5.              rw.AddResource("Title", "Professional C#");
  6.              rw.Close();
  7.          }
I added the resource file to my project and in below code i am get back my image and title
Expand|Select|Wrap|Line Numbers
  1. ResourceManager rm = new ResourceManager("Demo", Assembly.GetExecutingAssembly());
  2.             try
  3.             {
  4.                 logo.Image = (Image)rm.GetObject("WroxLogo");
  5.                 textTitle.Text = rm.GetString("Title");
  6.             }
  7.            //Catch Block here
  8.  
Expand|Select|Wrap|Line Numbers
  1. logo.Image = (Image)rm.GetObject("WroxLogo");
in this line My problem Starts and showing error

"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"Demo.resource s\" was correctly embedded or linked into assembly \"Namespace\ " at compile time, or that all the satellite assemblies required are loadable and fully signed."


Can any one explain me why this Exception is throwing?
Nov 12 '07 #5
CyberSoftHari
487 Recognized Expert Contributor
I solved my problem.

I am using ResourceManager , which is wrong
I have to use ResourceSet
ResourceSet rs = new ResourceSet("De mo.resources");
Nov 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3898
by: Frank Jones | last post by:
When manually running resgen.exe from the command prompt (Visual Studio .NET 2003 command prompt) I get the following error: error: Invalid ResX input. error: Specific exception: SerializationException Message: Invalid ResX input. ---> SerializationException: Cannot find the assembly Common, Version=1.0.1905.1173, Culture=neutral, PublicKeyToken=null. 2 error(s). The file within the project it is erroring on is a custom control.
0
499
by: David Krussow | last post by:
I had an aspx page (mypage.aspx) with a code behind file (mypage.aspx.cs) that in turn had a resx file (mypage.aspx.resx). I decided to create another aspx page (myotherpage.aspx) that would reuse the code-behind from the first page (mypage.aspx.cs). I hooked everything together and both aspx pages work great. In the process I renamed the code-behind file (mypage.aspx.cs). This caused a disconnect in the VS.NET IDE with the resx file. I...
1
1612
by: strout | last post by:
Do we need to deploy these type of file on server. Is .resx file embedded into dll or not? If not we should include resx file, right? strout
0
1692
by: prabhupr | last post by:
Hi Folks I'm currently working on a Localization+Globalization project; for this project, we need to generate ".Resx" files and we use "US English" Resx file as the base version, to compare the content with other languages. We have quite a number of Resx file and each Resx file has enough items so there is a high probability that we might miss few nodes/items in RESx files of other language.
0
1652
by: Steave | last post by:
Hi, using Managed C++ (.Net 2.0), I want to embed some images within an executable using a .resX file, and upon an event (in this case a combo box changing), I want the picture box to update with a different one. I tried the following code: System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(formDebayer::typeid));
0
2239
by: Rahul | last post by:
Hi I have a Project A that is being reffered by another WEB project Webber. In Project A i am using a resx file to store some information in it. I have m1de the Build Action of the Resx file to Content and set copy to output Directory property to Copy Always. I was expecting when i publish the web site I would see the resx file seperately and not packed inside the dll so that I can change the resx file dynamically. But to my surprise I...
1
2774
by: Sister Ray | last post by:
Hello, I'm trying to debug and compile a application that was developed by a collegue of mine, How ever when i try to build the application I always receive the following error: Compiling managed resources... error: Invalid ResX input. error: Specific exception: FileNotFoundException Message: Invalid ResX input. ---FileNotFoundException: File or assembly name FarPoint.Win.Spread, or one of its dependencies, was not found.
2
5151
by: Peter Afonin | last post by:
Hello, I'm new to Crystal reports. Recently I developed my first report, using class as a datasource, and it works OK. But when I created a second report, I started getting error: "Invalid report file path". I'm using exactly the same class as a datasource, and the path to the report is correct. I've checked the report folder permissions - they are OK. I'd searched Google and found quite a few posts about similar issues, but they...
8
14952
by: raylopez99 | last post by:
I have the latest version of Visual Studio 2008 Professional, which allows you to create resource files (this is the .resx file, no?), unlike the Express version, which does not. I am trying to cut and paste code that MSDN recommends for playing a simple wav file from inside an embedded file, like presumeably the 'resources' file .resx is. I want to embed the .wav file in a 'resource file' since I don't want the user storing the file on...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10216
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.