Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In a big project at work we have a solution that has many projects with user controls and forms. That is why we have one extra project called Resources that holds different kind of resources (separate resource files) for the whole solution:</p> <ul> <li>strings (translations)</li> <li>images</li> <li>property names</li> <li>and so on</li> </ul> <p>We reference the project to every other project in the solution where a resource is needed. This way the resources are kept separately, the dll can be easily replaced and nothing will be broken, as long the same resource names are used. </p> <p>We also use the dll assembly in complete different projects(solutions) where we need for example the same images. When named correctly (for example Company.Resources.dll -> Company.Resources.Images.Toolbar.Add/Remove/Settings) it fits very well into every new project.</p> <p>In your case it is of cource possible to reference ProjectA in ProjectB in order to use the same resources (as long the projects are in the same solution), but it could be that this will be not always possible (for example in order to avoid circular references). </p> <hr> <p>Create new WinForm solution (in my example one solution with two projects). Add new project of type <strong>Class Library</strong>:</p> <p><img src="https://i.stack.imgur.com/ixTUn.png" alt="Adding resources project"></p> <p>Add new resources to the <em>resources</em> project (in my example for strings and images):</p> <p><img src="https://i.stack.imgur.com/XKnO4.png" alt="adding resources to the resources project"></p> <p><img src="https://i.stack.imgur.com/coI1J.png" alt="add resources project resource"></p> <p><img src="https://i.stack.imgur.com/ZvQVK.png" alt="add texts"></p> <p>Adding a resource file for images:</p> <p><img src="https://i.stack.imgur.com/DlknC.png" alt="add images resources"></p> <p>Add some images:</p> <p><img src="https://i.stack.imgur.com/ohdtr.png" alt="adding images to the images resource file"></p> <p><img src="https://i.stack.imgur.com/Gj9rz.png" alt="adding images to the file"></p> <p>Now reference the resources project from the other projects:</p> <p><img src="https://i.stack.imgur.com/iqDl7.png" alt="reference the resources project"></p> <p><img src="https://i.stack.imgur.com/8Jcbd.png" alt="reference resources project"></p> <p><strong>Important</strong> => In order to use the resources from outside the assembly, you need to set the visibility to public:</p> <p><img src="https://i.stack.imgur.com/osFWs.png" alt="set resources visibility"></p> <p>Compile the solution once and use the references resources project from everywhere:</p> <p><img src="https://i.stack.imgur.com/sF1AW.png" alt="resources project usage"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload