This project is read-only.
Project Description
Generates a .resx file, and the accessor class to use the resource. Supports NAMED TYPED parameters for "inserts" {0}, {1}

Strings file format was introduced by Microsoft in early version of Enterprise Library. StringResourceTool was originally posted at GotDotNet site by Tom Hollander. Later it lived at Now it lives here.

What Is StringResourceTool2?

It is powerful replacement of standard ResXFileCodeGenerator in Visual Studiuo 2005. While VS2005 generates accessor class from resx, SRT2 generates resx and accessor from strings file.

The most important is typed parameters for {0}, {1}... formatting.

The best is to give an example:

Raw = Raw string
String1(string name) = With name argument {0}
String2(int name2, decimal amount, float chanceOfWinning) = Try number {0}, Amount of money {1:C}, Chance is {2}%

Add the file to project and set CustomTool property to StringResourceTool2 or SRT2. The tool will generate resx file as well as accessor class SR. You use it as follows:

Usage in code:
string s1 = SR.Raw;
string s2 = SR.String1(“Alex”);
string s3 = SR.String2(1, 12.3, 56.1);


  • Generates typed accessor class to string resources. Supports culture-specific resources.
  • Generates one accessor class for several *.strings files.
    • Result is one scope for names of resources .
    • Allows several developers to work simultaneously on resources and keep resource names under control.
    • Just set the same class name for *.strings you want to be in one scope. It works - partial class is generated.
  • Visibility of accessor class and raw ResourceManager(s) inside can be selected.


  • SRT2 ships with VS2005 macros which converts .resx to .strings. It understands that resource has {0},{1}.. inserts and generates parameters for them. This can be turned off and it will ignore inserts during conversion.

How it works

SR class looks like:

.CS file:
    internal partial class SR
        internal static string Raw
                return Keys.GetString(Keys.Raw);
        internal static string String1(string name)
            return Keys.GetString(Keys.StringArg, new object[] {

        internal static string String2(int name2, decimal amount, 
                                          float chanceOfWinning)
            return Keys.GetString(Keys.NumberArgs, new object[] {

When to use


How to use

Download and install the package, take a look at examples inside.
Add *.stirngs file to your project and set CustomTool property to "StringResourceTool2" or just "SRT2"

The tool is under development, examples about multi-culture resources are from OLD version of the tool.

In this version, add culture-specific *.strings as follows:

Don't forget to set CustomTool=SRT2 for all of them.
Note: accessor class is generated on the basis of neutral .strings file. For culture-specific .strings file the tool generates resources only.

Old version of the tool used the format:

It will not work in new version.
The script for conversion is coming very soon - by April, 27.



Last edited Apr 20, 2007 at 12:22 PM by AlexeyQ, version 7