• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

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?

Wint.

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,
0
WinterMuteUK
Asked:
WinterMuteUK
  • 2
1 Solution
 
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)?

Cheers

Wint.

0
 
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.

cheers

Wint.
0
 
GranModCommented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now