ThisAssembly.Resources 2.0.14

This project uses SponsorLink to attribute sponsor status (direct, indirect or implicit). For IDE usage (without warnings), sponsor status is required. IDE-only warnings will be issued after a grace period otherwise.

This package generates a static ThisAssembly.Resources class with public properties exposing typed APIs to retrieve the contents of embedded resources.

  <ItemGroup>
    <EmbeddedResource Include="Content/Docs/License.md" />
  </ItemGroup>

Since markdown files are text files, the API will expose a Text property property for it that will read its content once and cache it:

The $(EmbeddedResourceStringExtensions) MSBuild property allows customizing which file extensions get treated as text files. By default, it's defined as:

  <PropertyGroup>
    <EmbeddedResourceStringExtensions>.txt|.cs|.sql|.json|.md</EmbeddedResourceStringExtensions>
  </PropertyGroup>

You can append additional file extensions to this list, or override it completely. The list must be pipe-separated.

You can always use the provided GetStream and GetBytes for more advanced scenarios (or for non-text resources).

Optionally, you can specify the Kind metadata for a specific EmbeddedResource you want treated as a text file:

<ItemGroup>
    <EmbeddedResource Include="query.kql" Kind="Text" />
</ItemGroup>

You can also add a Comment item metadata attribute, which will be used as the <summary> XML doc for the generated member.

Adding dynamic resources

You can also provide additional embedded resources dynamically, by running a target before PrepareEmbeddedResources:

  <Target Name="AddDynamicResources" BeforeTargets="PrepareEmbeddedResources">
    <ItemGroup>
      <EmbeddedResource Include="Content/Docs/$(Configuration).md" />
    </ItemGroup>
  </Target>

Customizing the generated code

The following MSBuild properties can be used to customize the generated code:

Property Description
ThisAssemblyNamespace Sets the namespace of the generated ThisAssembly root class. If not set, it will be in the global namespace.
ThisAssemblyVisibility Sets the visibility modifier of the generated ThisAssembly root class. If not set, it will be internal.

Sponsors

Clarius Org MFB Technologies, Inc. Torutek DRIVE.NET, Inc. Keith Pickford Thomas Bolon Kori Francis Toni Wenzel Uno Platform Dan Siegel Reuben Swartz Jacob Foshee Eric Johnson David JENNI Jonathan Charley Wu Ken Bonny Simon Cropp agileworks-eu sorahex Zheyu Shen Vezel ChilliCream 4OTC Vincent Limo Jordan S. Jones domischell Mauricio Scheffer

Sponsor this project  

Learn more about GitHub Sponsors

Showing the top 20 packages that depend on ThisAssembly.Resources.

Packages Downloads
ThisAssembly
Meta-package that includes all ThisAssembly.* packages.
4
ThisAssembly
Meta-package that includes all ThisAssembly.* packages. > This project uses SponsorLink to attribute sponsor status (direct, indirect or implicit). For IDE usage, sponsor status is required. > IDE-only warnings will be emitted after a grace period otherwise. Learn more at https://github.com/devlooped#sponsorlink.
3
ThisAssembly
Meta-package that includes all ThisAssembly.* packages.
2
ThisAssembly
Meta-package that includes all ThisAssembly.* packages. > This project uses SponsorLink to attribute sponsor status (direct, indirect or implicit). For IDE usage, sponsor status is required. > IDE-only warnings will be emitted after a grace period otherwise. Learn more at https://github.com/devlooped#sponsorlink.
2

.NET Standard 2.0

Version Downloads Last updated
2.1.2 2 06/16/2026
2.1.1 3 06/16/2026
2.1.0 3 06/16/2026
2.1.0-rc.1 3 06/16/2026
2.1.0-rc 3 06/16/2026
2.1.0-beta 2 06/16/2026
2.0.14 3 06/16/2026
2.0.13 3 06/16/2026
2.0.12 3 06/16/2026
2.0.11 3 06/16/2026
2.0.10 3 06/16/2026
2.0.9 3 06/16/2026
2.0.8 3 06/16/2026
2.0.7 3 06/16/2026
2.0.6 3 06/15/2026
2.0.5 3 06/16/2026
2.0.4 3 06/16/2026
2.0.3 3 06/16/2026
2.0.2 3 06/16/2026
1.4.3 3 06/16/2026
1.4.2 3 06/16/2026
1.4.1 3 06/16/2026
1.4.0 3 06/16/2026
1.1.3 3 06/16/2026
1.1.1 3 06/16/2026