aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/csharp/Helloworld
diff options
context:
space:
mode:
authorGravatar kkm <kkm@smartaction.com>2018-10-11 20:22:40 -0700
committerGravatar kkm <kkm@smartaction.com>2018-10-14 02:24:12 -0700
commit6fcb5b29e18268c8948d5bd99c14fca13f9d7b67 (patch)
treea33e6b46ab61a0d8434751d13ecd137e711f2e0c /examples/csharp/Helloworld
parentd0cb61eada9d270b9043ec866b55c88617d362be (diff)
Redo C# examples to use new Grpc.Tools
* No pre-compilation of proto files required; * Tested under Windows and Linux dotnet and mono; * But not tested on Mac/mono; * README updated.
Diffstat (limited to 'examples/csharp/Helloworld')
-rw-r--r--examples/csharp/Helloworld/Greeter.sln2
-rw-r--r--examples/csharp/Helloworld/Greeter/Greeter.csproj15
-rw-r--r--examples/csharp/Helloworld/Greeter/Helloworld.cs312
-rw-r--r--examples/csharp/Helloworld/Greeter/HelloworldGrpc.cs149
-rw-r--r--examples/csharp/Helloworld/GreeterClient/GreeterClient.csproj8
-rw-r--r--examples/csharp/Helloworld/GreeterServer/GreeterServer.csproj8
-rw-r--r--examples/csharp/Helloworld/README.md32
-rw-r--r--examples/csharp/Helloworld/generate_protos.bat28
8 files changed, 22 insertions, 532 deletions
diff --git a/examples/csharp/Helloworld/Greeter.sln b/examples/csharp/Helloworld/Greeter.sln
index ca50470e66..a5ba98d0be 100644
--- a/examples/csharp/Helloworld/Greeter.sln
+++ b/examples/csharp/Helloworld/Greeter.sln
@@ -1,4 +1,4 @@
-
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
diff --git a/examples/csharp/Helloworld/Greeter/Greeter.csproj b/examples/csharp/Helloworld/Greeter/Greeter.csproj
index eba262565d..3421926dca 100644
--- a/examples/csharp/Helloworld/Greeter/Greeter.csproj
+++ b/examples/csharp/Helloworld/Greeter/Greeter.csproj
@@ -1,18 +1,15 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <AssemblyTitle>Greeter</AssemblyTitle>
- <TargetFrameworks>netcoreapp2.1</TargetFrameworks>
- <DebugType>portable</DebugType>
- <AssemblyName>Greeter</AssemblyName>
- <PackageId>Greeter</PackageId>
+ <TargetFramework>netstandard1.5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
- <PackageReference Include="Google.Protobuf.Tools" Version="3.6.1" />
- <PackageReference Include="Grpc" Version="1.14.1" />
- <PackageReference Include="Grpc.Tools" Version="1.14.1" />
+ <PackageReference Include="Grpc" Version="1.17.0" />
+ <PackageReference Include="Grpc.Tools" Version="1.17.0" PrivateAssets="All" />
+
+ <Protobuf Include="../../../protos/helloworld.proto" Link="helloworld.proto" />
</ItemGroup>
</Project>
diff --git a/examples/csharp/Helloworld/Greeter/Helloworld.cs b/examples/csharp/Helloworld/Greeter/Helloworld.cs
deleted file mode 100644
index e008ec27e5..0000000000
--- a/examples/csharp/Helloworld/Greeter/Helloworld.cs
+++ /dev/null
@@ -1,312 +0,0 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: helloworld.proto
-// </auto-generated>
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Helloworld {
-
- /// <summary>Holder for reflection information generated from helloworld.proto</summary>
- public static partial class HelloworldReflection {
-
- #region Descriptor
- /// <summary>File descriptor for helloworld.proto</summary>
- public static pbr::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbr::FileDescriptor descriptor;
-
- static HelloworldReflection() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "ChBoZWxsb3dvcmxkLnByb3RvEgpoZWxsb3dvcmxkIhwKDEhlbGxvUmVxdWVz",
- "dBIMCgRuYW1lGAEgASgJIh0KCkhlbGxvUmVwbHkSDwoHbWVzc2FnZRgBIAEo",
- "CTJJCgdHcmVldGVyEj4KCFNheUhlbGxvEhguaGVsbG93b3JsZC5IZWxsb1Jl",
- "cXVlc3QaFi5oZWxsb3dvcmxkLkhlbGxvUmVwbHkiAEI2Chtpby5ncnBjLmV4",
- "YW1wbGVzLmhlbGxvd29ybGRCD0hlbGxvV29ybGRQcm90b1ABogIDSExXYgZw",
- "cm90bzM="));
- descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
- new pbr::FileDescriptor[] { },
- new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Helloworld.HelloRequest), global::Helloworld.HelloRequest.Parser, new[]{ "Name" }, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Helloworld.HelloReply), global::Helloworld.HelloReply.Parser, new[]{ "Message" }, null, null, null)
- }));
- }
- #endregion
-
- }
- #region Messages
- /// <summary>
- /// The request message containing the user's name.
- /// </summary>
- public sealed partial class HelloRequest : pb::IMessage<HelloRequest> {
- private static readonly pb::MessageParser<HelloRequest> _parser = new pb::MessageParser<HelloRequest>(() => new HelloRequest());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser<HelloRequest> Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[0]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public HelloRequest() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public HelloRequest(HelloRequest other) : this() {
- name_ = other.name_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public HelloRequest Clone() {
- return new HelloRequest(this);
- }
-
- /// <summary>Field number for the "name" field.</summary>
- public const int NameFieldNumber = 1;
- private string name_ = "";
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public string Name {
- get { return name_; }
- set {
- name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as HelloRequest);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(HelloRequest other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (Name != other.Name) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (Name.Length != 0) hash ^= Name.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- if (Name.Length != 0) {
- output.WriteRawTag(10);
- output.WriteString(Name);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (Name.Length != 0) {
- size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(HelloRequest other) {
- if (other == null) {
- return;
- }
- if (other.Name.Length != 0) {
- Name = other.Name;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 10: {
- Name = input.ReadString();
- break;
- }
- }
- }
- }
-
- }
-
- /// <summary>
- /// The response message containing the greetings
- /// </summary>
- public sealed partial class HelloReply : pb::IMessage<HelloReply> {
- private static readonly pb::MessageParser<HelloReply> _parser = new pb::MessageParser<HelloReply>(() => new HelloReply());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser<HelloReply> Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[1]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public HelloReply() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public HelloReply(HelloReply other) : this() {
- message_ = other.message_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public HelloReply Clone() {
- return new HelloReply(this);
- }
-
- /// <summary>Field number for the "message" field.</summary>
- public const int MessageFieldNumber = 1;
- private string message_ = "";
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public string Message {
- get { return message_; }
- set {
- message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as HelloReply);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(HelloReply other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (Message != other.Message) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (Message.Length != 0) hash ^= Message.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- if (Message.Length != 0) {
- output.WriteRawTag(10);
- output.WriteString(Message);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (Message.Length != 0) {
- size += 1 + pb::CodedOutputStream.ComputeStringSize(Message);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(HelloReply other) {
- if (other == null) {
- return;
- }
- if (other.Message.Length != 0) {
- Message = other.Message;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 10: {
- Message = input.ReadString();
- break;
- }
- }
- }
- }
-
- }
-
- #endregion
-
-}
-
-#endregion Designer generated code
diff --git a/examples/csharp/Helloworld/Greeter/HelloworldGrpc.cs b/examples/csharp/Helloworld/Greeter/HelloworldGrpc.cs
deleted file mode 100644
index d6b959adc6..0000000000
--- a/examples/csharp/Helloworld/Greeter/HelloworldGrpc.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-// <auto-generated>
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: helloworld.proto
-// </auto-generated>
-// Original file comments:
-// Copyright 2015 gRPC authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-#pragma warning disable 0414, 1591
-#region Designer generated code
-
-using grpc = global::Grpc.Core;
-
-namespace Helloworld {
- /// <summary>
- /// The greeting service definition.
- /// </summary>
- public static partial class Greeter
- {
- static readonly string __ServiceName = "helloworld.Greeter";
-
- static readonly grpc::Marshaller<global::Helloworld.HelloRequest> __Marshaller_helloworld_HelloRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloRequest.Parser.ParseFrom);
- static readonly grpc::Marshaller<global::Helloworld.HelloReply> __Marshaller_helloworld_HelloReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloReply.Parser.ParseFrom);
-
- static readonly grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply> __Method_SayHello = new grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply>(
- grpc::MethodType.Unary,
- __ServiceName,
- "SayHello",
- __Marshaller_helloworld_HelloRequest,
- __Marshaller_helloworld_HelloReply);
-
- /// <summary>Service descriptor</summary>
- public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
- {
- get { return global::Helloworld.HelloworldReflection.Descriptor.Services[0]; }
- }
-
- /// <summary>Base class for server-side implementations of Greeter</summary>
- public abstract partial class GreeterBase
- {
- /// <summary>
- /// Sends a greeting
- /// </summary>
- /// <param name="request">The request received from the client.</param>
- /// <param name="context">The context of the server-side call handler being invoked.</param>
- /// <returns>The response to send back to the client (wrapped by a task).</returns>
- public virtual global::System.Threading.Tasks.Task<global::Helloworld.HelloReply> SayHello(global::Helloworld.HelloRequest request, grpc::ServerCallContext context)
- {
- throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
- }
-
- }
-
- /// <summary>Client for Greeter</summary>
- public partial class GreeterClient : grpc::ClientBase<GreeterClient>
- {
- /// <summary>Creates a new client for Greeter</summary>
- /// <param name="channel">The channel to use to make remote calls.</param>
- public GreeterClient(grpc::Channel channel) : base(channel)
- {
- }
- /// <summary>Creates a new client for Greeter that uses a custom <c>CallInvoker</c>.</summary>
- /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
- public GreeterClient(grpc::CallInvoker callInvoker) : base(callInvoker)
- {
- }
- /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
- protected GreeterClient() : base()
- {
- }
- /// <summary>Protected constructor to allow creation of configured clients.</summary>
- /// <param name="configuration">The client configuration.</param>
- protected GreeterClient(ClientBaseConfiguration configuration) : base(configuration)
- {
- }
-
- /// <summary>
- /// Sends a greeting
- /// </summary>
- /// <param name="request">The request to send to the server.</param>
- /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
- /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
- /// <param name="cancellationToken">An optional token for canceling the call.</param>
- /// <returns>The response received from the server.</returns>
- public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return SayHello(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- /// <summary>
- /// Sends a greeting
- /// </summary>
- /// <param name="request">The request to send to the server.</param>
- /// <param name="options">The options for the call.</param>
- /// <returns>The response received from the server.</returns>
- public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::CallOptions options)
- {
- return CallInvoker.BlockingUnaryCall(__Method_SayHello, null, options, request);
- }
- /// <summary>
- /// Sends a greeting
- /// </summary>
- /// <param name="request">The request to send to the server.</param>
- /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
- /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
- /// <param name="cancellationToken">An optional token for canceling the call.</param>
- /// <returns>The call object.</returns>
- public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return SayHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- /// <summary>
- /// Sends a greeting
- /// </summary>
- /// <param name="request">The request to send to the server.</param>
- /// <param name="options">The options for the call.</param>
- /// <returns>The call object.</returns>
- public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::CallOptions options)
- {
- return CallInvoker.AsyncUnaryCall(__Method_SayHello, null, options, request);
- }
- /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
- protected override GreeterClient NewInstance(ClientBaseConfiguration configuration)
- {
- return new GreeterClient(configuration);
- }
- }
-
- /// <summary>Creates service definition that can be registered with a server</summary>
- /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
- public static grpc::ServerServiceDefinition BindService(GreeterBase serviceImpl)
- {
- return grpc::ServerServiceDefinition.CreateBuilder()
- .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build();
- }
-
- }
-}
-#endregion
diff --git a/examples/csharp/Helloworld/GreeterClient/GreeterClient.csproj b/examples/csharp/Helloworld/GreeterClient/GreeterClient.csproj
index 24a89d58c5..ac10d85497 100644
--- a/examples/csharp/Helloworld/GreeterClient/GreeterClient.csproj
+++ b/examples/csharp/Helloworld/GreeterClient/GreeterClient.csproj
@@ -1,12 +1,8 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <AssemblyTitle>GreeterClient</AssemblyTitle>
- <TargetFrameworks>netcoreapp2.1</TargetFrameworks>
- <DebugType>portable</DebugType>
- <AssemblyName>GreeterClient</AssemblyName>
+ <TargetFramework>netcoreapp2.1</TargetFramework>
<OutputType>Exe</OutputType>
- <PackageId>GreeterClient</PackageId>
</PropertyGroup>
<ItemGroup>
diff --git a/examples/csharp/Helloworld/GreeterServer/GreeterServer.csproj b/examples/csharp/Helloworld/GreeterServer/GreeterServer.csproj
index 9ea1fa3817..ac10d85497 100644
--- a/examples/csharp/Helloworld/GreeterServer/GreeterServer.csproj
+++ b/examples/csharp/Helloworld/GreeterServer/GreeterServer.csproj
@@ -1,12 +1,8 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <AssemblyTitle>GreeterServer</AssemblyTitle>
- <TargetFrameworks>netcoreapp2.1</TargetFrameworks>
- <DebugType>portable</DebugType>
- <AssemblyName>GreeterServer</AssemblyName>
+ <TargetFramework>netcoreapp2.1</TargetFramework>
<OutputType>Exe</OutputType>
- <PackageId>GreeterServer</PackageId>
</PropertyGroup>
<ItemGroup>
diff --git a/examples/csharp/Helloworld/README.md b/examples/csharp/Helloworld/README.md
index 4871132426..e4771ee91a 100644
--- a/examples/csharp/Helloworld/README.md
+++ b/examples/csharp/Helloworld/README.md
@@ -3,41 +3,31 @@ gRPC in 3 minutes (C#)
BACKGROUND
-------------
-For this sample, we've already generated the server and client stubs from [helloworld.proto][].
-
-Example projects in this directory depend on the [Grpc](https://www.nuget.org/packages/Grpc/)
-and [Google.Protobuf](https://www.nuget.org/packages/Google.Protobuf/) NuGet packages
-which have been already added to the project for you.
+This is a version of the helloworld example using the dotnet SDK
+tools to compile [helloworld.proto][] in a common library, build the server
+and the client, and run them.
PREREQUISITES
-------------
- The [.NET Core SDK 2.1+](https://www.microsoft.com/net/core)
-You can also build the example directly using Visual Studio 2017, but it's not a requirement.
-
-BUILD
--------
-
-From the `examples/csharp/Helloworld` directory:
+You can also build the solution `Greeter.sln` using Visual Studio 2017,
+but it's not a requirement.
-- `dotnet build Greeter.sln`
-
-Try it!
--------
+BUILD AND RUN
+-------------
-- Run the server
+- Build and run the server
```
- > cd GreeterServer
- > dotnet run -f netcoreapp2.1
+ > dotnet run -p GreeterServer
```
-- Run the client
+- Build and run the client
```
- > cd GreeterClient
- > dotnet run -f netcoreapp2.1
+ > dotnet run -p GreeterClient
```
Tutorial
diff --git a/examples/csharp/Helloworld/generate_protos.bat b/examples/csharp/Helloworld/generate_protos.bat
deleted file mode 100644
index ab0c0eb46a..0000000000
--- a/examples/csharp/Helloworld/generate_protos.bat
+++ /dev/null
@@ -1,28 +0,0 @@
-@rem Copyright 2016 gRPC authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem http://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-
-@rem Generate the C# code for .proto files
-
-setlocal
-
-@rem enter this directory
-cd /d %~dp0
-
-@rem packages will be available in nuget cache directory once the project is built or after "dotnet restore"
-set PROTOC=%UserProfile%\.nuget\packages\Google.Protobuf.Tools\3.6.1\tools\windows_x64\protoc.exe
-set PLUGIN=%UserProfile%\.nuget\packages\Grpc.Tools\1.14.1\tools\windows_x64\grpc_csharp_plugin.exe
-
-%PROTOC% -I../../protos --csharp_out Greeter ../../protos/helloworld.proto --grpc_out Greeter --plugin=protoc-gen-grpc=%PLUGIN%
-
-endlocal