BUG: "System.Resources.MissingManifestResourceException" error message after you change the name of a localized form class in Visual C++ .NET 2003 (839298)



The information in this article applies to:

  • Microsoft Visual C++ .NET (2003)
  • 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 "System.Resources.MissingManifestResourceException" 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 "MyForm.resources" was correctly embedded or linked into assembly "Q839298".

baseName: MyForm locationInfo: Q839298.MyForm resource file name: MyForm.resources assembly: Q839298, Version=1.0.1546.20800, Culture=neutral, PublicKeyToken=null
Note In this error message, Q839298 is a placeholder for the namespace name of your application, and MyForm 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 Q839298.MyForm.resources, while you generate Q839298.Form1.resources.

Note Q839298 is a placeholder for the namespace name of your application, and MyForm 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 "Symptoms" 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)/Q839298.Form1.resources to $(IntDir)/Q839298.MyForm.resources, and then click OK.

    Note Here Q839298 is a placeholder for the namespace name of your application, and MyForm is a placeholder for the class name of your form class that you localized.
  7. Press CTRL+SHIFT+S to save the project.
  8. Press CTRL+SHIFT+B to build the solution.
  9. 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 "Applies to" section.

MORE INFORMATION

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 "Symptoms" section.

Modification Type:MinorLast Reviewed:12/29/2005
Keywords:kbWindowsForms kbResX kbResource kbNameSpace kbForms kbProperties kbLocalization kberrmsg kbcode kbbug KB839298 kbAudDeveloper