Using Rummage Type Renamer to rename specific types

RummageTypeRenamer is a free command-line tool distributed with Rummage. It enables you to change the name of one or more type to another name of your choice. This tool is available for free even if you do not own a Rummage license; simply download and install Rummage.

Unlike Rummage, the type renamer requires that you specify both the original name and the new name. Moreover, unlike Rummage, the renamer will not verify whether the rename will break the assembly (for example, due to the use of reflection). The renamer is therefore a poor choice for obfuscation. It is instead intended for fixing specific issues when using tools such as ILMerge.

Installation

This tool is installed along with Rummage. Once you've downloaded and installed Rummage, it can be found under C:\Program Files\Rummage\RummageTypeRenamer.exe (assuming you used the default installation path).

Usage

RummageTypeRenamer is a command-line tool, and the following instructions assume that you are familiar with how to use command-line tools in general.

To rename a type, specify the options -f <OriginalName> -t <NewName> with the original and the desired type names. You must specify the full type name, including namespace — more on this later. To rename multiple types, you must specify a separate pair of -f and -t options for each type to be renamed.

By default the renamer will exit with an error if the original type cannot be found. If you want this to be ignored instead, specify the -i option. This can be useful in shared build scripts.

Finally, specify the filename of the input assembly, and, optionally, the filename of the output assembly. If you omit the output assembly filename, the tool will overwrite the input file without confirmation.

RummageTypeRenamer will update the debug symbols (*.pdb) accordingly if it finds them.

Type name rules

Type names must be specified in full, including the namespace. For example,

RummageTypeRenamer.exe -f Aldaray.Program -t Aldaray.TEST MyAssembly.exe

Generic types are specified by appending the number of generic type arguments, separated by a backtick. For example, given the C# type Aldaray.CustomList<T>, you could rename it as follows:

RummageTypeRenamer.exe -f Aldaray.CustomList`1 -t Aldaray.TEST`1 MyAssembly.exe

The type will be renamed to Aldaray.TEST<T>. More accurately, the type's name under the hood is actually Aldaray.TEST`1, with the backtick, but by convention this corresponds to a C# type named Aldaray.TEST<T>. It is possible to rename a generic type to something without the suffix, or indeed to something containing characters not allowed in type names by C# at all.

Namespaces may be added, removed, and modified arbitrarily. It is possible to put any type into any namespace, regardless of whether other types with the same namespace already exist. For example:

RummageTypeRenamer.exe -f Aldaray.Rummage.MainForm -t MainForm MyAssembly.exe

will move the type MainForm from the Aldaray.Rummage namespace into the top-level namespace.

Limitations

This tool can only rename types declared in the main module of the input assembly.

Nested types cannot currently be renamed, however if you require this feature please do let us know or drop us a quick note anonymously.

There is currently no way to rename generic type arguments, or indeed any other named elements in the assembly.