tags:

views:

1845

answers:

1

Hi, I have created a series of resource (resx) files to hold language specific string data. Following various tutorials i have placed the base resource file (MyResources.resx) in the root folder of the solution and other subsequent resource files, eg (MyResources.en-AU.resx) side by side in the solution. In saying all of this everything works fine, until i create a folder in the solution explorer for example, called "Culture" and then move one or all of the resource files into that folder. After doing this i am getting a MissingManifestResourceException. As soon as i move them back out into the root folder of the solution explorer no problems.

Can anyone explain what is going on here? How can i move these resource files away from the root solution?

Regards

+1  A: 

When you say you moved the resource files, do you mean you manually moved them on the file system? If that's the case, obviously the build tool won't be able to find the files, since they're still referenced by their "old" locations. Try removing the resource file from the project and then "Add existing item" and add it back. Don't forget to back everything up before you try it, of course...

Edit: When you move a file into a folder, that folder name becomes part of the namespace. So, for example, if you had a resource file called Resource1, and you accessed it by Resource1.String1, after moving it into "Folder" it would become Folder.Resource1.String1

Tal Pressman
no i moved them within vstudio. note: the solution always built regardless of the resource file location. the problem was trying to access the the string data.
Grant
Did you remember to change the namespace you are trying to access the resources through? When you move it into a folder, that folder name becomes part of the namespace. So, for example, if you had a resource file called Resource1, and you accessed it by Resource1.String1, after moving it into "Folder" it would become Folder.Resource1.String1.
Tal Pressman
Thankyou very much Tal, i didnt know a folder became part of the namespace.Cheers!
Grant