It can be used from C# like so:
namespace TryIt { class TryProtoGen { static void Main(string[] args) { Froto.Roslyn.ProtoGen.generate(@"..\..\riak.proto", "Riak", "RiakProto", @"..\..\riak.cs"); } } }You just have to install it vi NuGet, add FSharp.Core, and redirect the FSharp.Core version in App.config. The reason this is needed is because FParsec 0.9.2.0 was built with the older version.
xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
This is the first build. I'm sure I'm missing some protobuf-net annotations. The intention is to use the generated code within a generative F# Type Provider. I've done some work on this, but have run into two roadblocks.- Types in the generated assembly don't appear to be loading. I get errors like: typecheck error FS1109: A reference to the type 'tutorial.PhoneNumber' in assembly 'proto' was found, but the type could not be found in that assembly
I even compiled the open source fsc.exe and tracked the problem down to Microsoft.FSharp.Compiler.Import.AssemblyLoader.LoadAssembly, but got lost in the code. - stackoverflow: How do I distribute an F# TypeProvider via NuGet?
All the code is open source. Take a look at ProtoGen.fs and the supporting Roslyn.fs.