MissingManifestResourceException suddenly appearing when converting from .Net 1.1 to .Net 2.0

Posted on 2006-03-20
Last Modified: 2011-09-20
Hi there,

This problem manifests (ha ha) itself at the following line in all my WinForms projects in my solution:

public void InitializeComponent()
 ...yadda yadda...

    this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); //Exception!!

 ...yadda yadda...

Now, this code worked absolutely fine in VS2003, .Net 1.1, no troubles, but I've just recently converted to .Net 2.0 and have now started getting this exception.
I don't have a resource file, I just set the Icon for the project to be 'x.ico'.

For the moment, by commenting out the offending line I can get the system to start, but I want my icons back, how and why?


Ps. So you don't suggest here are the solutions I've tried:
 * Ensuring namespace and default namespace are the same,
 * Removing and readding the Icon,
 * I don't have any classes/enums/structs etc defined *above* my Form class,
Question by:WinterMuteUK
    LVL 9

    Author Comment

    Update to those who are watching/listening in...

    I've found the problem appears to be lying with the .resx files for each of the forms, when I pull down the files from source control the files are 'greyed out' i.e. in the project I will see:

      [-] FrmMyForm.cs
           |- FrmMyForm.resx

    with the resx icon being a white square.

    If I right click on the resx file and 'Include in project' the icon changes to a 'text document with an arrow coming in from the top left corner' as it should do.

    Good news: On compiling *this* version and running it, it all works! Huzzah!
    Bad news: Well, more of a question, why isn't the resx file being automatically associated as part of the project, it always used to be (in VS2003)?



    LVL 9

    Author Comment

    Well no joy so i'll close this question.

    Just to clarify on initially getting the solution from the source control I could see nothing but the 'FrmMyForm.cs' file (no resx file blank or not), and had to open my Source client and get the latest version. This put all the resx files in the right place, and upon restarting Visual Studio I got to the point I was in up above.

    Hopefully the answer will be of use to some people.



    Accepted Solution

    Closed, 500 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now