gtfs-realtime-bindings icon indicating copy to clipboard operation
gtfs-realtime-bindings copied to clipboard

Add .Net Core bindings

Open jsiedentop opened this issue 5 years ago • 6 comments
trafficstars

.Net Framework is supported, but there is no binding for .Net Core. It would be great, if you ship the NuGet Package as a .Net Standard package, so it can be used on any platform.

jsiedentop avatar Feb 19 '20 09:02 jsiedentop

@jsiedentop Here's our current process for generating the .NET bindings: https://github.com/MobilityData/gtfs-realtime-bindings/blob/master/dotnet/UPDATING.md

It uses a 3rd party library for generating the bindings.

~~It looks like there is an official C# generator, though, that we could use: https://github.com/protocolbuffers/protobuf/tree/master/csharp~~ EDIT We can't use this, it's only for proto3 files.

I think that would address your need? Or is there a simpler way to generate the package you're looking for using the existing process but different command-line parameters for build/release?

I'm not a .NET developer, so community feedback on this issue would be great.

barbeau avatar Feb 19 '20 14:02 barbeau

@barbeau Thanks for the reply. In C# you can decide to develop with the .Net Framewok (the "old framework") or with .Net Core (the "new framework"). It is not possible to load an assemply, developed in the one framework, from a project developed in the other framework. For that reason there is a subset of both frameworks, the .Net Standard. If MobilityData would publish the implementation with .Net Standard, it would be possible to use the NuGet Package in both Frameworks.

the big drawback from the .Net Framework is, that it is not platform independent. So, it runs only on Windows. With .Net Core it's possible to run on any platform.

jsiedentop avatar Feb 21 '20 18:02 jsiedentop

@jsiedentop I'm certainly in favor of publishing the bindings in a way that's available on the most platforms. The problem is that we have to use existing tools to generate the bindings, so we're limited based on what those tools can do. And unfortunately, looking at https://github.com/protocolbuffers/protobuf/tree/master/csharp again, it only supports proto3 files, and GTFS-realtime is proto2. So we can't use Google's official protocol buffer compiler - that's why we're using a 3rd party compiler: https://github.com/protobuf-net/protobuf-net

If you can take a look at the 3rd party compiler and our existing documentation for updating the .NET bindings and suggest specific changes to the process to accomplish publishing the bindings with .NET Standard, I'm certainly open to looking at it. Pull requests welcome!

barbeau avatar Feb 21 '20 21:02 barbeau

You can also multi-target NuGet packages to Standard, Framework, and Core.

JoeSchulte avatar Oct 25 '22 22:10 JoeSchulte