Sharing resource files between different VS projects

0.00 avg. rating (0% score) - 0 votes

A .NET resource file created by VS contains:

1. Resources.resx: XML declaration of all resources

2. Resources.Designer.vb: autogenerated by VS custom tool (VbMyResourcesResXFileCodeGenerator) during the build process. This file facilitates the accessing of resources from .NET code (e.g. My.Resources namespace in VB and [ProjectName].Resources in C#). Everytime the resources file changes, VS will run the tool to re-generate the resources designer file. The re-generation process can also be done manually by right clicking the .resx file and choose Run Custom Tool.

3. In the property of the .resx file, CustomTool is set to VbMyResourcesResXFileCodeGenerator and CustomToolNamespace is My.Resources (for VB). Build action for .resx file should be Embedded Resources

To share resources file between 2 projects:

1. In the first project, proceed to create the resource file as per normal

2. In the 2nd project, create the resource file as per normal. After that, remove the .resx file and .designer.vb from the project (you may need to enable View->Show All Files in order to see these files under Project). Proceed to add the .resx file and .designer.vb file from the first project into the current project as link

3. For these 2 added files, make sure the Build Action, Custom Tool and Custom Tool Namespace has been set accordingly.

Note: If resources are shared between desktop and device projects, there are chances that the code generated by the custom tool for the desktop project will overwrite that of the device, causing incompatibilities and build errors. As a work around, if such errors occur, before building, right click the resources file and choose Run custom tool.

0.00 avg. rating (0% score) - 0 votes


A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>