|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Globalization question.I create a class library. Then I add default resource file to support
globalization and add strings. I want to use these resource strings outside of this assembly, but I see that the generator makes all strings as internal static properties. Is there any way to make them public, so I can use them from another assembly? I've run into exactly the same problem, and there are a few ways to work
around it. The underlying problem is, as you point out, that the generator marks everything as internal. These easiest way for me to work around this is was to have the attribute: [assembly: InternalsVisibleTo("Coversant.SoapBox.Services.Translation,PublicKey=0024...")] present in my resource assembly. I was able to do this, as I know exactly what assemblies are going to need access to the resource files. Doing this allowed me to have a "Coversant.SoapBox.xxx.Common" assembly that has all of my resources. The other assemblies then use these resources as if they were public. It works just fine. The only tricky part was getting the public key signature right - I used ildasm for that. If you're not strong naming your assemblies, then I would imagine you can skip that step. -- Show quoteChris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP http://www.coversant.com/blogs/cmullins "Alexander Kolev" <AlexanderKo***@discussions.microsoft.com> wrote: >I create a class library. Then I add default resource file to support > globalization and add strings. I want to use these resource strings > outside > of this assembly, but I see that the generator makes all strings as > internal > static properties. > Is there any way to make them public, so I can use them from another > assembly? > > 1. Create a library that is only resource files
2. Create another project and reference the external resource file For Windows Forms, this is pretty straightforward, although I do not have an example. For ASP.NET (where I am currently using it) download Michele Bustamante's article on external resources and get her code (linked in article): http://msdn2.microsoft.com/en-us/library/aa905797.aspx I have blogged my recent adventures in ASP.NET on my blog http://gregorybeamer.spaces.live.com -- Show quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA ********************************************* Think outside the box! ********************************************* "Alexander Kolev" <AlexanderKo***@discussions.microsoft.com> wrote in message news:2FCB1C5E-9FF0-49DA-BF19-F065C62AAA9A@microsoft.com... >I create a class library. Then I add default resource file to support > globalization and add strings. I want to use these resource strings > outside > of this assembly, but I see that the generator makes all strings as > internal > static properties. > Is there any way to make them public, so I can use them from another > assembly? > > |
|||||||||||||||||||||||