ResxCodeGenerator 1.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ResxCodeGenerator --version 1.4.0                
NuGet\Install-Package ResxCodeGenerator -Version 1.4.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ResxCodeGenerator" Version="1.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ResxCodeGenerator --version 1.4.0                
#r "nuget: ResxCodeGenerator, 1.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ResxCodeGenerator as a Cake Addin
#addin nuget:?package=ResxCodeGenerator&version=1.4.0

// Install ResxCodeGenerator as a Cake Tool
#tool nuget:?package=ResxCodeGenerator&version=1.4.0                

ResxCodeGenerator

Generates strongly typed wrapper classes. Include contants for each string resource. Avoid the usage of "magic string". Ensure code and resource file coherence.

The generated classes are named with the same name as their associated resx. These classes can then be used as follows:

file : MyResource.en.resx

    @inject IMyResourceLocalizer Localizer
    <span>@Localizer.Hello</span>

As the designated solution for localization is to use IStringLocalizer.

Usage

  • Install the package
Install-Package ResxCodeGenerator
  • Define .resx files
  • On the paramters of the resx set <generation action> to "additionnal c# analyzer file"

in csproj this look like this

<ItemGroup>
  <AdditionalFiles Include="*.en.resx" /> 
</ItemGroup>

N.B. - Set this option for only one language per resource. Otherwise, the generated classes will conflict.

License

MIT

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ResxCodeGenerator:

Package Downloads
ResxCodeGenerator

A code generator for .resx files

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.6 110 7/11/2024
1.4.0 88 7/11/2024

Initial release