Pinecone.TypedPath
1.0.4
dotnet add package Pinecone.TypedPath --version 1.0.4
NuGet\Install-Package Pinecone.TypedPath -Version 1.0.4
<PackageReference Include="Pinecone.TypedPath" Version="1.0.4" />
<PackageVersion Include="Pinecone.TypedPath" Version="1.0.4" />
<PackageReference Include="Pinecone.TypedPath" />
paket add Pinecone.TypedPath --version 1.0.4
#r "nuget: Pinecone.TypedPath, 1.0.4"
#:package Pinecone.TypedPath@1.0.4
#addin nuget:?package=Pinecone.TypedPath&version=1.0.4
#tool nuget:?package=Pinecone.TypedPath&version=1.0.4
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)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.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.