简体   繁体   中英

resx sharing between projects

I have a solution named 'mySolution' with two projects:

  • ProjectA
  • ProjectB

ProjectA contains a resource file named 'mySolutionResources.resx'.
ProjectB refrences projectA, but can't access resources in mySolutionResources.

After some research I found that: "resource classes are all marked as internal".

My question now is:

If I want to maintain only one 'mySolutionResources.resx', how can I do to get access to it from projectB? If it is not possible, is there another aproach ?

If you open the 'mySolutionResources.resx' (in designer) and on top you will see option of Access Modifier: [Internal] . You can change this value to [Public] . This should expose the resource data to other projects if referenced.

Rather than sharing resx files, I would prefer to write code in one assembly to expose the resources externally (depending on the nature of the resources). If you don't want that 'sharing' code to be public, you could always use InternalsVisibleTo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM