Category Archives: MS .NET

.NET Core – Compiling applications for multiple platforms

Modify project.json

"frameworks": {
  "netcoreapp1.0": {
    "dependencies": {
      "Microsoft.NETCore.App": {
        "version": "1.0.1"
      }
    }
  } 
}
"runtimes": {
     "win10-x64": {},
     "osx.10.10-x64": {},
     "ubuntu.14.04-x64": {}
   }

From the CLI run:

dotnet restore
dotnet build -r win10-x64
dotnet build -r osx.10.10-x64
dotnet build -r ubuntu.14.04-x64

dotnet publish -c release -r win10-x64
dotnet publish -c release -r osx.10.10-x64
dotnet publish -c release -r ubuntu.14.04-x64

Reference: Self-Contained NET Core Applications

Google Protobuf – Generate C# POCO from .proto files using Protobuf-net

Google’s Protobuf code generator uses an API that many .NET developers may find a bit different than the usual MO.

An alternative to Google’s Protobuf implementation is Marc Gravell’s protobuf-net library, which uses an implementation that may make more sense to .NET developers. However, the code generator for this library is nowhere to be found in the nuget package. You can download it here.

The following is an example of executing the CLI tool

protogen -i:input.proto -o:output.cs

Google Protobuf: C# Generating a Class from a .proto file

The example found on the csharp tutorial page doesn’t work. Instead do the following

  1. Open visual studio, open nuget command line, type :Install-Package Google.ProtocolBuffers , link : ProtocolBuffers 2.4.1.555
  2. Find Package/Google.ProtocolBuffers.2.4.1.555/tools/ProtoGen.exe
  3. Use command line, type : ProtoGen.exe addressbook.proto -output_directory=C:\trash

Source: Stackoverflow Post

Update 6/13/2017

Marc Gravell has an online tool for generating C# code from a .proto file.

http://protogen.marcgravell.com/