Microsoft KB Archive/839298

= BUG: &quot;System.Resources.MissingManifestResourceException&quot; error message after you change the name of a localized form class in Visual C++ .NET 2003 =

Article ID: 839298

Article Last Modified on 12/29/2005

-

APPLIES TO


 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft .NET Framework 1.1

-





SUMMARY
''This article discusses a bug in Microsoft Visual C++ .NET 2003. When you change the name of a localized form class in a Windows Forms Application (.NET) project, and then you run the project, you receive a &quot;System.Resources.MissingManifestResourceException&quot; exception error message. This article describes how to work around this problem by correcting the Resource File Name property.''



SYMPTOMS
When you change the name of a localized form class in a Windows Forms Application (.NET) project in Visual C++ .NET 2003, and then you run the project, you receive the following error message:

An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure &quot; .resources&quot; was correctly embedded or linked into assembly &quot; &quot;.

baseName:  locationInfo:. resource file name: .resources assembly: , Version=1.0.1546.20800, Culture=neutral, PublicKeyToken=null

Note In this error message,  is a placeholder for the namespace name of your application, and   is a placeholder for the class name of your form class that you localized.



CAUSE
This problem occurs because you changed your localized form class name in various places, but you did not change the Resource File Name property of the .resX file of the project. Therefore, the code to create the ResourceManager object looks for the resources file in the form of. .resources, while you generate .Form1.resources.

Note  is a placeholder for the namespace name of your application, and   is a placeholder for the class name of your form class that you localized.



RESOLUTION
To work around this problem, change the Resource File Name property of the .resX file of the project. To do this, follow these steps:
 * 1) Start Visual Studio .NET 2003.
 * 2) Open the project that contains the localized form class where you receive the error message that is mentioned in the &quot;Symptoms&quot; section.
 * 3) In Solution Explorer, expand all folders.
 * 4) Right-click Form1.resX, and then click Properties.
 * 5) In the Form1.resX Property Pages dialog box, expand Configuration Properties, and then click General under Managed Resources.
 * 6) Change the Resource File Name property from $(IntDir)/ .Form1.resources to $(IntDir)/ . .resources, and then click OK.

Note Here  is a placeholder for the namespace name of your application, and   is a placeholder for the class name of your form class that you localized.
 * 1) Press CTRL+SHIFT+S to save the project.
 * 2) Press CTRL+SHIFT+B to build the solution.
 * 3) Press F5 to run the application. The application runs, and the Form1 form is displayed.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the behavior

 * 1) Start Visual Studio .NET 2003.
 * 2) On the File menu, point to New, and then click Project.
 * 3) Under Project Types, click Visual C++ Projects, and then click Windows Forms Application (.NET) under Templates.
 * 4) In the Name box, type Q839298, and then click OK. By default, a form that is named Form1 is created.
 * 5) Right-click Form1, and then click Properties.
 * 6) Set the Localizable property to True.
 * 7) Right-click Form1, and then click View Code.
 * 8) In the code window, change the class name from Form1 to MyForm in the first line of class definition, in the constructor function, and in the InitializeComponent function.
 * 9) In Solution Explorer, expand all folders.
 * 10) In the Source Files folder, double-click Form1.cpp.
 * 11) In the code window, change Form1 to MyForm in the _tWinMain function.
 * 12) Press CTRL+SHIFT+S to save the project.
 * 13) Press CTRL+SHIFT+B to build the solution.
 * 14) Press F5 to run the application.

You receive the error message that is mentioned in the &quot;Symptoms&quot; section.

Additional query words: Localized Form, Resource File Name, NameSpace, class name, ComponentResourceManager, .resX file, Localizable property

Keywords: kberrmsg kbbug kbwindowsforms kbnamespace kbproperties kbresx kbresource kbforms kblocalization kbcode KB839298

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.