Last post Feb 08, 2007 03:07 PM by aweil
Feb 08, 2007 04:25 AM|tednyberg|LINK
I'm developing a web application through a solution consisting of several different projects; one for custom controls, one for web services etc. However, I would like to create a single project within the solution which contains all resource files (.resx).
I've found some different examples of handling this, for example by implementing a ResourceManager that loads the resource files at runtime, but I don't find that kind of solution to be particularly pretty.
What I've tried to do is to:
However, I get an error because all the resources are automatically declared as
internal. Is there any way of changing this without modifying the auto-generated code? I'm guessing the auto-generated code will be overwritten the next time I modify a resource file and re-compile it...
Any help would be greatly appreciated! Thanks!
Feb 08, 2007 03:07 PM|aweil|LINK
Not a beautiful solution, but what you can do is to declare them as public.
Instead of modifying the auto-generated file, just copy it into a new file (it's a partial class, so you can add to it with other files). In the new file, declare the properties as public, and slightly change their names (to avoir conflicts).
As I said, it's not so beautiful, because it will mean manually adding a new property to that file when adding a new resource.
Personnally, I think I'd go for the ResourceManager solution you just mentioned. You can turn it into something not so awful by writing a helper class to access the resources.