jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers
Apache License 2.0
511 stars 51 forks source link

Running the Compiler #44

Closed RotsiserMho closed 3 years ago

RotsiserMho commented 4 years ago

Hello, my C#/NuGet knowledge is a little weak, so I apologize if this is a dumb question. I'm using Visual Studio for macOS and I installed the NuGet package for the compiler. I'd like to setup a script to execute it from the command line to generate the C# code from my .fbs file. I assume I have to invoke dotnet [something-or-other]. I found this documentation for .NET Core tools, but running dotnet tool list does not show that the FlatSharp compiler is installed, although I do see it in the [home]/.nuget/packages/flatsharp.compiler/3.0.0/tools/netcoreapp2.1 folder. How can I install the compiler package and invoke it from the command-line without referencing that specific path?

jamescourtney commented 4 years ago

If you include a FlatSharpSchema element in your .csproj, it should get invoked from the build. Take a look at the samples section in this repo to see some usages. My MSBuild knowledge is also not the strongest, so it's possible I've somehow borked the nuget package.