Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 Winforms keeps forgetting resources

For some reason on my current project I create my resource file via the project properties, add a load of existing images. Then go to add these images to menu items, save it. At this point everything looks fine and the images are all mapped correctly.

However once I close the designer for that form, then open it up I get the error dialog saying:

The type 'My.Project.Properties.Resources' has no property named 'icon_plus'.

The annoying thing is that if you follow it through to the code there is no error, it compiles fine:

this.newToolStripMenuItem.Image = global::My.Project.Properties.Resources.icon_plus;

I have tried deleting all resources and removing the resource file from the project, completely closing down the IDE then re-loading it. I have moved the location of the files, but I am just out of ideas and it is REALLY starting to grate with about 10 forms and controls which each give me this error them remove the icons from the UI.

like image 781
Grofit Avatar asked Apr 19 '12 21:04

Grofit


2 Answers

Take a look at project references, and remove the reference to self.

like image 194
Dejan Janjušević Avatar answered Oct 10 '22 08:10

Dejan Janjušević


This is one of those VERY annoying issues, which I would never have thought about until I got another issue which caused me to change things.

It seems to have been down to the application using the Client Profile for .net 4 rather than just the default .net 4 runtimes. Once I changed this over this issue stopped and my other missing namespace issue which recently arose went away.

like image 22
Grofit Avatar answered Oct 10 '22 07:10

Grofit