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

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,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WinterMuteUKAuthor Commented:
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)?



WinterMuteUKAuthor Commented:
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.


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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.