C# Resources.resx Question (VS2008)

N

NvrBst

I need my resource file in a generic namespace to be accessable by a
shared class. I change the Resources.resx File Properties -> Custom
Tool Namespace: MyResources. This field is under the "Custom Tool:
ResXFileCodeGenerator" property.

This works fine. I can now access the resource like so
"MyResources.MyBitmapFile" etc. However, when looking into the
"Resources.Designer.cs" file I see the following line:

new
global::System.Resources.ResourceManager("MyProj.Properties.Resources",
typeof(Resources).Assembly);


Should "MyProj.Properties.Resources" not be "MyResources.Resources"?
The Program seems to work both ways but whenever I change it to
"MyResources.Resources" it seems to randomly switch back to the
"MyProj.Properties..." (namily when I add new resources to the file,
among other actions). Is this something I should bother to keep
changing? Or is the "Custom Tool Namespace" not suppose to be used
like this? Maybe suggestions on the proper way to do it?

Thanks
NB
 
N

Nicholas Paldino [.NET/C# MVP]

The designer is changing the code back for you.

The parameter you are seeing is for the root name of the resource file,
not the namespace that the class is a member of. So you don't need to
change it (the designer would have done it for you if you needed to change
it).
 
N

NvrBst

    The designer is changing the code back for you.

    The parameter you are seeing is for the root name of the resource file,
not the namespace that the class is a member of.  So you don't need to
change it (the designer would have done it for you if you needed to change
it).

--
          - Nicholas Paldino [.NET/C# MVP]
          - (e-mail address removed)




I need my resource file in a generic namespace to be accessable by a
shared class.  I change the Resources.resx File Properties -> Custom
Tool Namespace: MyResources.  This field is under the "Custom Tool:
ResXFileCodeGenerator" property.
This works fine.  I can now access the resource like so
"MyResources.MyBitmapFile" etc.  However, when looking into the
"Resources.Designer.cs" file I see the following line:

Should "MyProj.Properties.Resources" not be "MyResources.Resources"?
The Program seems to work both ways but whenever I change it to
"MyResources.Resources" it seems to randomly switch back to the
"MyProj.Properties..." (namily when I add new resources to the file,
among other actions).  Is this something I should bother to keep
changing? Or is the "Custom Tool Namespace" not suppose to be used
like this?  Maybe suggestions on the proper way to do it?
Thanks
NB- Hide quoted text -

- Show quoted text -

Ahh thank you. Seems I was a little confused with what root name
was :)

NB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top