ResxFormatter Gallery feed (extension)

Formats .resx files: Sorts data entries by name and removes schema and xml comments.

▼ Download
Author
Stefan Egli
Version
4.0.123
Updated
28 days ago
Tags
resources, resx, formatting
Supports
VS 2022 VS 2026

ResxFormatter

[!IMPORTANT] This project is in maintenance mode and will at most receive maintenance updates. We recommend switching to PNFmt instead. PNFmt includes this formatter in a unified .NET tool, but it does not provide a Visual Studio extension.

Optimizes resx files after saving: Removes schema and comments (in particular the 3KB documentation that is included in every resx file) and sorts entries alphabetically so that they look like this:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <schema />
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="a" xml:space="preserve">
    <value>LESS CLUTTER</value>
  </data>
  <data name="b" xml:space="preserve">
    <value>SORTED BY KEYS</value>
  </data>
</root>

Use only with a source control system and at your own risk. See the change log for changes and road map.


Download this extension from the Visual Studio Marketplace or get the CI build.

Build status

Settings

EditorConfig

Formatting rules are configured in the EditorConfig file as follows:

[*.resx]
resx_formatter_sort_entries=true
resx_formatter_remove_xsd_schema=true
resx_formatter_remove_documentation_comment=true
resx_formatter_sort_comparer=OrdinalIgnoreCase

Comparer can be one of the following: InvariantCulture, InvariantCultureIgnoreCase, OrdinalIgnoreCase, Ordinal. The default value is Ordinal.

When the EditorConfig Language Service version 1.18.35 or newer is installed, the ResxFormatter VSIX contributes these properties to its IntelliSense and validation. Restart Visual Studio after installing or updating either extension so that the custom schema is loaded.

| :information_source: You can format all resx files in the current solution folder via Extensions > ResxFormatter menu. | | ---- |

Visual Studio

A few things can be configured and probably you want to have this done as follows:

Settings

Use the experimental setting with caution since it may have undesired side effects. It is also worth to note, that the extension may insert schema or documentation comment in order to match the desired effect of your EditorConfig settings.

Agent Skill / CLI

Download resxfmt-<version>.zip from an AppVeyor build and extract its resxfmt directory into your Codex skills directory. The skill uses the PetchNaka.ResxFormatter.Cli .NET global tool and does not bundle an executable.

Invoke the agent skill with:

Use $resxfmt to check and format the .resx files in this repository.

The agent will detect when the tool is missing and can help install it. To install it directly, first install the .NET 10 SDK and then run:

dotnet tool install --global PetchNaka.ResxFormatter.Cli

Update an existing installation with:

dotnet tool update --global PetchNaka.ResxFormatter.Cli

Run resxfmt from the directory containing the resource files you want to process. The command syntax is resxfmt [options] [<path> ...]. Use --check to detect required changes without writing, --dry-run to preview, --recursive to include subdirectories, and --verbose for detailed output. Formatting follows the applicable EditorConfig settings; without a path, the current directory is processed.

The CLI reports updated, would-update, unchanged, skipped, or failed for each file. Exit code 1 means --check found pending changes; exit code 2 means a usage, path, access, or formatting failure.

Contributing

Please use the issue tracker for submitting bug reports or feature requests.

License

MIT License

Third Party Licenses

LibraryLicense
EditorConfig .NET CoreMIT License
xUnitApache License 2.0 / MIT License
NFluentApache License 2.0
Community toolkit for Visual Studio extensionsApache License 2.0