473,769 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS .NET 2005 Global Resources

Hello,
I'm working on a large solution, comprised on numerous Projects, and I
would like to have one central projects that contains a set of global
RESX Resources. It doesn't make sense to have various resources
(strings, images, etc...) scattered through the application; having
them all in one central area will be a huge boon.

The problem that I'm running into is being able to access these
resources from external assemblies. I have created a
"CompanyResourc es" Assembly, that contains a Resources.resx with all my
resources. Code is then automatically generated for this, and placed
in a Resources.Desig ner.cs file. For classes residing in my
CompanyResource s assembly, I have strongly typed access to the
resources. For example, if I have an image titled "MATERIAL_REACT ANT",
I can access this image from within the resources assembly with:

Properties.Reso urces.MATERIAL_ REACTANT;

Unfortunately, I cannot get strongly typed access to these resources
from classes outside of the resources assembly.

If I examine the autogenerated code in Resources.Desig ner.cs, I see
that the class and all resource properties are "internal":

internal class Resources {
...
internal static System.Drawing. Bitmap MATERIAL_REACTA NT
....
}

Obviously there is no way of accessing these properties from outside of
the assembly, when things are internal. Is there a way to get around
this?

I did find a way to access these resources from other assemblies by
doing the following:

private System.Resource s.ResourceManag er resources_ = new
System.Resource s.ResourceManag er("CompanyReso urces.Propertie s.Resources",
System.Reflecti on.Assembly.Loa d("CompanyResou rces"));
The downside of doing this is that I lose strongly typed access (and
intellisense) to the resources. So instead of:
resources_.MATE RIAL_REACTANT

I have to do:
resources_.GetO bject("MATERIAL _REACTANT");
It seems that there must be some way around this. Clearly one of the
benefits of .NET Resources is being able to have strongly typed access,
and it would seem that having one global location for all resources
should be possible.

Any suggestions?

Thanks,
Spencer Miles

Feb 17 '06 #1
1 3207
Figured out a solution...

See:
http://forums.microsoft.com/MSDN/Sho...45329&SiteID=1

Feb 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.