none
Share Resource File between Projects? RRS feed

  • Question

  • Hello,

    I have an solution that generates two executables as output.  Basically, one application is a GUI tool, and the other is an nonGUI executable that processes output from the GUI tool.  The GUI tool inserts tokens (i.e. MYTOKEN) into a text editor, which the nonGUI executable replaces with meaningful text when it processes the text. 

    Both applications are localized for several different languages...

    My goal is to avoid replicating tokens and token translations into two separate sets of resource files.  I would like both projects in the solution to use a common set of resource files.

    Is it possible for the nonGUI application to use the GUI's resource files when it builds and in code?  In other words, I would like to embed all resource strings in the GUI's resource files and have both projects use them when building.  In code in both applications, I would like to be able to use the following to get resource strings:

    string token = MyGUINamespace.Properties.Resources.ResourceManager.GetString("UITheToken", CultureInfo.CurrentCulture);

     Currently, I get the following messages in the nonGUI project when it builds and uses the previous line of code to access resources in the GUI project:

    "MyGUINamespace.Properties.Resources is inaccessible due to its protection level"

    "MyGUINamespace.Properties.Resources does not contain a definition for ResourceManager"

    The previous line of code works great in the GUI project, just not in the nonGUI one.  Both projects are in the same solution.  I've tried placing both projects in the same namespace, but it didn't help...

    Thanks for any and all ideas and suggestions...

     

    Mike

     

     

    Sunday, July 16, 2006 9:03 PM

Answers

  • The ideal way is to use a shared assembly.You can load it from each proejct using reflection and get the string from that using resource manager
    Monday, July 17, 2006 11:35 AM
  • Thanks for the idea!  I'll give it a try! 

    Mike

    Wednesday, July 19, 2006 10:32 PM

All replies

  • The ideal way is to use a shared assembly.You can load it from each proejct using reflection and get the string from that using resource manager
    Monday, July 17, 2006 11:35 AM
  • Thanks for the idea!  I'll give it a try! 

    Mike

    Wednesday, July 19, 2006 10:32 PM