# RESX Designer Auto-Generator A VS Code extension that automatically regenerates Designer.cs files when RESX resource files are saved. ## Features - **Automatic Regeneration**: Watches for changes to .resx files and automatically regenerates corresponding Designer.cs files - **Smart Detection**: Automatically finds ResGen.exe on your system across different .NET SDK and Visual Studio installations - **Debounced Updates**: Prevents excessive regeneration during rapid file changes - **Status Updates**: Shows progress in the status bar with visual indicators - **Configurable**: Customizable settings for different project needs - **Cross-Platform**: Works on Windows, macOS, and Linux (where .NET SDK is available) ## Requirements - .NET SDK or Visual Studio installed (for ResGen.exe) - VS Code 1.101.0 or higher ## Quick Start 1. Install the extension 2. Open a workspace containing .resx files 3. Edit and save a .resx file 4. Watch as the Designer.cs file is automatically regenerated! ## Configuration The extension can be configured through VS Code settings: ### `resxDesignerAutoGenerator.enabled` - **Type**: `boolean` - **Default**: `true` - **Description**: Enable/disable automatic regeneration ### `resxDesignerAutoGenerator.showNotifications` - **Type**: `boolean` - **Default**: `true` - **Description**: Show success/error notifications ### `resxDesignerAutoGenerator.debounceDelay` - **Type**: `number` - **Default**: `2000` - **Range**: 500-10000 - **Description**: Delay in milliseconds before regenerating after a file change ### `resxDesignerAutoGenerator.resGenPaths` - **Type**: `array` - **Default**: `[]` - **Description**: Custom paths to ResGen.exe (auto-detected if empty) ### `resxDesignerAutoGenerator.watchPatterns` - **Type**: `array` - **Default**: `["**/*.resx"]` - **Description**: Glob patterns for watching .resx files ## Commands ### `RESX Designer: Regenerate Designer.cs` Manually regenerate the Designer.cs file for a selected .resx file. Available in: - Command Palette (Ctrl+Shift+P) - Explorer context menu (right-click on .resx files) ### `RESX Designer: Show Output` Show the extension's output channel for debugging and monitoring. ### `RESX Designer: Reload Configuration` Reload the extension configuration and restart file watchers. ## How It Works 1. **File Watching**: The extension monitors .resx files in your workspace using VS Code's FileSystemWatcher API 2. **Debouncing**: When a .resx file changes, the extension waits for the configured delay to avoid rapid-fire regenerations 3. **ResGen Detection**: Automatically finds ResGen.exe in common locations: - .NET Framework SDK locations - Visual Studio installations (2019, 2022) - System PATH 4. **Namespace Detection**: Analyzes your project structure to determine the correct namespace for generated classes 5. **Code Generation**: Executes ResGen.exe with the appropriate parameters to generate strongly-typed Designer.cs files 6. **Cleanup**: Removes temporary .resources files that ResGen creates ## Supported File Patterns By default, the extension watches for files matching: - `**/*.resx` - All .resx files in the workspace You can customize this in the settings to watch specific folders or file patterns. ## Troubleshooting ### ResGen.exe Not Found If you see this error, try: 1. Install the .NET SDK from [https://dotnet.microsoft.com/download](https://dotnet.microsoft.com/download) 2. Install Visual Studio with .NET development workload 3. Manually specify the path in `resxDesignerAutoGenerator.resGenPaths` setting ### Designer.cs Not Generated 1. Check the Output panel (View → Output → RESX Designer Auto-Generator) 2. Ensure the .resx file is valid XML 3. Verify write permissions in the project directory 4. Try the manual regenerate command ### Performance Issues 1. Adjust the `debounceDelay` setting to a higher value 2. Use more specific `watchPatterns` to exclude unnecessary files 3. Add large folders to VS Code's `files.watcherExclude` setting ## Example Configuration ```json { "resxDesignerAutoGenerator.enabled": true, "resxDesignerAutoGenerator.showNotifications": false, "resxDesignerAutoGenerator.debounceDelay": 3000, "resxDesignerAutoGenerator.watchPatterns": [ "**/Resources/**/*.resx", "**/Properties/**/*.resx" ] } ``` ## Installation ### From VS Code Marketplace 1. Open VS Code 2. Go to Extensions (Ctrl+Shift+X) 3. Search for "RESX Designer Auto-Generator" 4. Click Install ### From VSIX File 1. Download the .vsix file 2. Open VS Code 3. Press Ctrl+Shift+P 4. Type "Extensions: Install from VSIX" 5. Select the downloaded .vsix file ## Development To contribute or modify this extension: ```bash git clone cd resx-designer-auto-generator npm install code . ``` Press F5 to launch a new VS Code window with the extension loaded for testing. ## License This extension is released under the MIT License. See LICENSE file for details. ## Support - Report issues on [GitHub Issues](https://github.com/your-username/resx-designer-auto-generator/issues) - Feature requests welcome! ## Changelog ### 1.0.0 - Initial release - Automatic .resx file watching - Designer.cs regeneration - Configurable settings - Status bar integration - Command palette integration