Tool for automatically generating YML serialization classes from schema files
-
Navigate to the Bonsai.Sgen toolbox NuGet package
-
Click
NET CLI (Local)
and copy the two suggested commands. E.g.:dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Bonsai.Sgen --version 0.1.0
-
To view the tool help reference documentation, run:
dotnet bonsai.sgen --help
-
To generate serialization classes from a schema file:
dotnet bonsai.sgen --schema schema.json
-
Copy the generated class file to your project
Extensions
folder. -
Add the necessary package references to your
Extensions.csproj
file. For instance:<ItemGroup> <PackageReference Include="Bonsai.Core" Version="2.8.0" /> <PackageReference Include="YamlDotNet" Version="12.0.2" /> </ItemGroup> </Project>
-
To restore the tool at any point, run:
dotnet tool restore