Recently, I ran into a great free Microsoft tool which is called – Resource Refactoring Tool. This tool provides developers an easy way to extract hard coded strings from the code to resource files.

Resource files (.resx files) consists of XML entries, which specify objects and string inside XML tags. Those files can be opened with text editors and are completely readable and maintainable. One of its common usage is for localization.

Tool features:

  1. Works with C#, VB.Net languages.
  2. Supports all project types including web sites and web application projects.
  3. Finds other instances of the text being replaced in the project automatically.
  4. Lists existing resources by their similarity level to the text being replaced.
  5. Automatically replaces hard coded string with a reference to resource entry.
  6. A preview window to show changes.

How does it work?

Right click on a hard coded string, choose Refactor and then Extract To Resource.

Extract To Resource

The next screen pops up where we can:

  • Choose whether to extract just the current hard coded string / All instances in the current source file / All instances in the project.
  • Choose whether to use an existing resource file or to create a new one.
  • Create a new entry in the resource file.
  • Getting a preview dialog to see the changes before they actually happen.

image 

After closing this dialog, the string will automatically be replaced with the reference to the resource that have been chosen.

This tool works on Visual Studio 2005 and 2008, but when both Visual Studio 2008 and 2005 are installed, the Resource Refactoring Tool is not installed on Visual Studio 2008.

Download it here, enjoy…

Tags :

3 Responses to “Free Tool – Extract Hard Coded Strings to Resource Files”


  1. Regev Porat

    Said on April 13, 2008 :

    Very nice – thanks!!

2 Trackback(s)

  1. May 20, 2008: PHARMANCY information. » PHARMANCY.ORG
  2. Feb 4, 2010: Productivity Addins http://www.dev102.c… « Ask Visual Studio

Post a Comment