Skip to main content

Pinecone.TypedPath by Nick Pinecone

NuGet / site data

Nuget GitHub last commit GitHub Repo stars

Details

Info

info

Name: Pinecone.TypedPath

.NET source generator for strongly typed file paths

Author: Nick Pinecone

NuGet: https://www.nuget.org/packages/Pinecone.TypedPath/

You can find more details at https://github.com/nickpinecone/typed-path

Source: https://github.com/nickpinecone/typed-path

Author

note

Nick Pinecone Alt text

Original Readme

note

Typed Path

Nuget License GitHub

.NET source generator for strongly typed file paths

Install

Install the package from nuget

dotnet add package Pinecone.TypedPath

Make sure to include the package as a source generator

<ItemGroup>
<PackageReference Include="Pinecone.TypedPath" Version="..." ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
</ItemGroup>
Configuration

The Sample project includes the full example

First add the folder to .csproj as AdditionalFiles

<ItemGroup>
<AdditionalFiles Include="Assets/**" />
</ItemGroup>

Then define a partial class with TypedPath attribute and ITypedPath interface

[TypedPath("Assets")]
public partial class Assets : ITypedPath
{
public static string Wrap(string path)
{
return path;
}
}

After that you can just reference the path you need

> Console.WriteLine(Assets.SubFolder.NestedFolder.SuperNested);

Assets/SubFolder/NestedFolder/SuperNested.json
Note for Rider

Related to RIDER-75959

While the source generator works with most file types (.json, .png, etc.),
Rider's IntelliSense may not detect changes with .txt and potentially other files.

Builds will still work correctly (this is purely an IDE issue)

About

note

Generating typed paths for file system navigation and manipulation.

How to use

Example (source csproj, source files)

This is the CSharp Project that references Pinecone.TypedPath

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="MyFolderToShow/**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Pinecone.TypedPath" Version="1.0.4" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>

Generated Files

Those are taken from $(BaseIntermediateOutputPath)\GX

namespace FolderToCode;

[global::System.CodeDom.Compiler.GeneratedCode("TypedPath", "1.0.0")]
public partial class MyFolder
{
public static partial class en
{
public static readonly string A = Wrap("MyFolder\en\a.json");
}
public static partial class ro
{
public static readonly string A = Wrap("MyFolder\ro\a.json");
}
}

Useful

Download Example (.NET C#)

Share Pinecone.TypedPath

https://ignatandrei.github.io/RSCG_Examples/v2/docs/Pinecone.TypedPath

Category "FilesToCode" has the following generators:

1 Chorn.EmbeddedResourceAccessGenerator Nuget GitHub Repo stars 2024-01-21

2 corecraft Nuget GitHub Repo stars 2024-02-17

3 Datacute.EmbeddedResourcePropertyGenerator Nuget GitHub Repo stars 2024-11-03

4 DotnetYang Nuget GitHub Repo stars 2024-06-29

5 EmbedResourceCSharp Nuget GitHub Repo stars 2023-04-16

6 kli.Localize Nuget GitHub Repo stars 2025-10-01

7 LingoGen Nuget GitHub Repo stars 2024-02-23

8 Maestria.TypeProviders Nuget GitHub Repo stars 2026-04-09

9 NFH.FileEmbed Nuget GitHub Repo stars 2025-08-08

10 NotNotAppSettings Nuget GitHub Repo stars 2024-01-26

11 Pinecone.TypedPath Nuget GitHub Repo stars 2026-08-24

12 Podimo.ConstEmbed Nuget GitHub Repo stars 2023-04-16

13 ResXGenerator Nuget GitHub Repo stars 2023-10-02

14 RSCG_JSON2Class Nuget GitHub Repo stars 2024-02-29

15 RSCG_Utils Nuget GitHub Repo stars 2023-04-16

16 Strings.ResourceGenerator Nuget GitHub Repo stars 2025-07-06

17 SvgIconGenerator Nuget GitHub Repo stars 2026-04-04

18 ThisAssembly_Resources Nuget GitHub Repo stars 2023-09-16

19 ThisAssembly.Strings Nuget GitHub Repo stars 2024-07-21

20 TypedPaths Nuget GitHub Repo stars 2026-04-01

21 Weave Nuget GitHub Repo stars 2024-01-27

See category

FilesToCode