Meziantou.Framework.ResxSourceGenerator
1.0.12
Prefix Reserved
dotnet add package Meziantou.Framework.ResxSourceGenerator --version 1.0.12
NuGet\Install-Package Meziantou.Framework.ResxSourceGenerator -Version 1.0.12
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="Meziantou.Framework.ResxSourceGenerator" Version="1.0.12"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Meziantou.Framework.ResxSourceGenerator --version 1.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Meziantou.Framework.ResxSourceGenerator, 1.0.12"
#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 Meziantou.Framework.ResxSourceGenerator as a Cake Addin #addin nuget:?package=Meziantou.Framework.ResxSourceGenerator&version=1.0.12 // Install Meziantou.Framework.ResxSourceGenerator as a Cake Tool #tool nuget:?package=Meziantou.Framework.ResxSourceGenerator&version=1.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Meziantou.Framework.ResxSourceGenerator
Generate code to access the content of resx files. It does provides more methods than the generator provided by Visual Studio. For instance, it parses placeholders in text and provides method
<?xml version="1.0" encoding="utf-8"?>
<root>
<data name="Hello" xml:space="preserve">
<value>Hello {0}!</value>
</data>
</root>
_ = Sample.Hello; // Hello {0}
_ = Sample.FormatHello("meziantou"); // Hello meziantou
The generator also supports binary resources and expose them as byte[]
.
How to configure the source generator
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
<DefaultResourcesNamespace>Sample</DefaultResourcesNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Framework.ResxSourceGenerator" Version="1.0.0" />
<AdditionalFiles Include="**/*.resx" />
<AdditionalFiles Include="file1.resx"
Namespace="CustomNamespace"
ClassName="CustomClassName"
ResourceName="CustomResourceFileName"
Visibility="public"
GenerateResourcesType="True"
GenerateKeyNamesType="True"
/>
</ItemGroup>
</Project>
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.