Pinecone.TypedPath by Nick Pinecone
NuGet / site data
Details
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
Author
Nick Pinecone

Original Readme
Typed Path
.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
Generating typed paths for file system navigation and manipulation.
How to use
Example (source csproj, source files)
- CSharp Project
- Program.cs
- MyFolder.cs
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>
This is the use of Pinecone.TypedPath in Program.cs
using FolderToCode;
Console.WriteLine(MyFolder.en.A);
Console.WriteLine(MyFolder.ro.A);
This is the use of Pinecone.TypedPath in MyFolder.cs
using System;
using System.Collections.Generic;
using System.Text;
using TypedPath;
namespace FolderToCode;
[TypedPath("MyFolderToShow")]
public partial class MyFolder: ITypedPath
{
public static string Wrap(string path)
{
return path;
}
}
Generated Files
Those are taken from $(BaseIntermediateOutputPath)\GX
- TypedPath.MyFolder.g.cs
- TypedPathAttribute.g.cs
- TypedPathInterface.g.cs
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");
}
}
using System;
namespace TypedPath;
[global::System.CodeDom.Compiler.GeneratedCode("TypedPath", "1.0.0")]
[AttributeUsage(AttributeTargets.Class)]
public class TypedPathAttribute : Attribute
{
public string Path \{ get; }
public bool OriginalFilename \{ get; }
public TypedPathAttribute(string path, bool originalFilename = false)
{
Path = path;
OriginalFilename = originalFilename;
}
}
namespace TypedPath;
[global::System.CodeDom.Compiler.GeneratedCode("TypedPath", "1.0.0")]
public interface ITypedPath
{
public static abstract string Wrap(string path);
}
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
2024-01-21
2 corecraft
2024-02-17
3 Datacute.EmbeddedResourcePropertyGenerator
2024-11-03
4 DotnetYang
2024-06-29
5 EmbedResourceCSharp
2023-04-16
6 kli.Localize
2025-10-01
7 LingoGen
2024-02-23
8 Maestria.TypeProviders
2026-04-09
9 NFH.FileEmbed
2025-08-08
10 NotNotAppSettings
2024-01-26
11 Pinecone.TypedPath
2026-08-24
12 Podimo.ConstEmbed
2023-04-16
13 ResXGenerator
2023-10-02
14 RSCG_JSON2Class
2024-02-29
15 RSCG_Utils
2023-04-16
16 Strings.ResourceGenerator
2025-07-06
17 SvgIconGenerator
2026-04-04
18 ThisAssembly_Resources
2023-09-16
19 ThisAssembly.Strings
2024-07-21
20 TypedPaths
2026-04-01
21 Weave
2024-01-27