aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/csharp/HelloworldLegacyCsproj
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/HelloworldLegacyCsproj
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/HelloworldLegacyCsproj')
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/Greeter.sln2
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj23
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/Greeter/Helloworld.cs312
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/Greeter/HelloworldGrpc.cs149
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config10
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj8
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config6
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj8
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config6
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/README.md27
-rw-r--r--examples/csharp/HelloworldLegacyCsproj/generate_protos.bat26
11 files changed, 46 insertions, 531 deletions
diff --git a/examples/csharp/HelloworldLegacyCsproj/Greeter.sln b/examples/csharp/HelloworldLegacyCsproj/Greeter.sln
index 49e364d91c..26cae7a727 100644
--- a/examples/csharp/HelloworldLegacyCsproj/Greeter.sln
+++ b/examples/csharp/HelloworldLegacyCsproj/Greeter.sln
@@ -1,4 +1,4 @@
-
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
diff --git a/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj b/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj
index 197a9fb625..da15ba3954 100644
--- a/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj
+++ b/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj
@@ -1,5 +1,6 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -36,7 +37,7 @@
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
- <HintPath>..\packages\Grpc.Core.1.14.1\lib\net45\Grpc.Core.dll</HintPath>
+ <HintPath>..\packages\Grpc.Core.1.17.0\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
@@ -47,25 +48,23 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Helloworld.cs" />
- <Compile Include="HelloworldGrpc.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
- <None Include="..\..\..\protos\helloworld.proto">
+ <Protobuf Include="..\..\..\protos\helloworld.proto">
<Link>protos\helloworld.proto</Link>
- </None>
- <None Include="..\generate_protos.bat">
- <Link>generate_protos.bat</Link>
- </None>
+ </Protobuf>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
- <Import Project="..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets')" />
+ <Import Project="..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
- <Error Condition="!Exists('..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets'))" />
+ <Error Condition="!Exists('..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets'))" />
+ <Error Condition="!Exists('..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.props'))" />
+ <Error Condition="!Exists('..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.targets'))" />
</Target>
-</Project> \ No newline at end of file
+ <Import Project="..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.1.17.0\build\Grpc.Tools.targets')" />
+</Project>
diff --git a/examples/csharp/HelloworldLegacyCsproj/Greeter/Helloworld.cs b/examples/csharp/HelloworldLegacyCsproj/Greeter/Helloworld.cs
deleted file mode 100644
index e008ec27e5..0000000000
--- a/examples/csharp/HelloworldLegacyCsproj/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/HelloworldLegacyCsproj/Greeter/HelloworldGrpc.cs b/examples/csharp/HelloworldLegacyCsproj/Greeter/HelloworldGrpc.cs
deleted file mode 100644
index d6b959adc6..0000000000
--- a/examples/csharp/HelloworldLegacyCsproj/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/HelloworldLegacyCsproj/Greeter/packages.config b/examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config
index 23857be22f..154b599321 100644
--- a/examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config
+++ b/examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.6.1" targetFramework="net45" />
- <package id="Grpc" version="1.14.1" targetFramework="net45" />
- <package id="Grpc.Core" version="1.14.1" targetFramework="net45" />
- <package id="Grpc.Tools" version="1.14.1" targetFramework="net45" />
+ <package id="Grpc" version="1.17.0" targetFramework="net45" />
+ <package id="Grpc.Core" version="1.17.0" targetFramework="net45" />
+ <package id="Grpc.Tools" version="1.17.0" targetFramework="net45" developmentDependency="true" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
-</packages> \ No newline at end of file
+</packages>
diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj
index 3bb7ff1ee1..31a3a90345 100644
--- a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj
+++ b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -36,7 +36,7 @@
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
- <HintPath>..\packages\Grpc.Core.1.14.1\lib\net45\Grpc.Core.dll</HintPath>
+ <HintPath>..\packages\Grpc.Core.1.17.0\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
@@ -59,11 +59,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
- <Import Project="..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets')" />
+ <Import Project="..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
- <Error Condition="!Exists('..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets'))" />
+ <Error Condition="!Exists('..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets'))" />
</Target>
</Project> \ No newline at end of file
diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config
index df4df8282c..2fd8228689 100644
--- a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config
+++ b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.6.1" targetFramework="net45" />
- <package id="Grpc" version="1.14.1" targetFramework="net45" />
- <package id="Grpc.Core" version="1.14.1" targetFramework="net45" />
+ <package id="Grpc" version="1.17.0" targetFramework="net45" />
+ <package id="Grpc.Core" version="1.17.0" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj
index 4396b04efe..27ca963040 100644
--- a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj
+++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -36,7 +36,7 @@
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
- <HintPath>..\packages\Grpc.Core.1.14.1\lib\net45\Grpc.Core.dll</HintPath>
+ <HintPath>..\packages\Grpc.Core.1.17.0\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
@@ -59,11 +59,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
- <Import Project="..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets')" />
+ <Import Project="..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
- <Error Condition="!Exists('..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.14.1\build\net45\Grpc.Core.targets'))" />
+ <Error Condition="!Exists('..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.17.0\build\net45\Grpc.Core.targets'))" />
</Target>
</Project> \ No newline at end of file
diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config
index df4df8282c..2fd8228689 100644
--- a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config
+++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.6.1" targetFramework="net45" />
- <package id="Grpc" version="1.14.1" targetFramework="net45" />
- <package id="Grpc.Core" version="1.14.1" targetFramework="net45" />
+ <package id="Grpc" version="1.17.0" targetFramework="net45" />
+ <package id="Grpc.Core" version="1.17.0" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/examples/csharp/HelloworldLegacyCsproj/README.md b/examples/csharp/HelloworldLegacyCsproj/README.md
index 6d42c5ef25..60b09e0925 100644
--- a/examples/csharp/HelloworldLegacyCsproj/README.md
+++ b/examples/csharp/HelloworldLegacyCsproj/README.md
@@ -3,21 +3,21 @@ gRPC in 3 minutes (C#)
BACKGROUND
-------------
-This is a different version of the helloworld example, using the old-style .csproj
-files supported by VS2013 and VS2015 (and older versions of mono).
-You can still use gRPC with the old-style .csproj files, but [using the new-style
-.csproj projects](../helloworld/README.md) (supported by VS2017 and dotnet SDK) is recommended.
-
-For this sample, we've already generated the server and client stubs from [helloworld.proto][].
-
-Example projects depend on the [Grpc](https://www.nuget.org/packages/Grpc/), [Grpc.Tools](https://www.nuget.org/packages/Grpc.Tools/)
+This is a different version of the helloworld example, using the "classic" .csproj
+files, the only format supported by VS2013 (and older versions of mono).
+You can still use gRPC with the classic .csproj files, but [using the new-style
+.csproj projects](../helloworld/README.md) (supported by VS2015 Update3 and above,
+and dotnet SDK) is recommended.
+
+Example projects depend on the [Grpc](https://www.nuget.org/packages/Grpc/),
+[Grpc.Tools](https://www.nuget.org/packages/Grpc.Tools/)
and [Google.Protobuf](https://www.nuget.org/packages/Google.Protobuf/) NuGet packages
which have been already added to the project for you.
PREREQUISITES
-------------
-- Windows: .NET Framework 4.5+, Visual Studio 2013 or 2015
+- Windows: .NET Framework 4.5+, Visual Studio 2013 or higher
- Linux: Mono 4+, MonoDevelop 5.9+
- Mac OS X: Xamarin Studio 5.9+
@@ -28,12 +28,15 @@ BUILD
# Using Visual Studio
-* Build the solution (this will automatically download NuGet dependencies)
+* Select "Restore NuGet Packages" from the solution context menu. It is recommended
+ to close and re-open the solution after the packages have been restored from
+ Visual Studio.
+* Build the solution.
# Using Monodevelop or Xamarin Studio
-The nuget add-in available for Xamarin Studio and Monodevelop IDEs is too old to
-download all of the nuget dependencies of gRPC.
+The NuGet add-in available for Xamarin Studio and Monodevelop IDEs is too old to
+download all of the NuGet dependencies of gRPC.
Using these IDEs, a workaround is as follows:
* Obtain a nuget executable for your platform and update it with
diff --git a/examples/csharp/HelloworldLegacyCsproj/generate_protos.bat b/examples/csharp/HelloworldLegacyCsproj/generate_protos.bat
deleted file mode 100644
index d1e7160f91..0000000000
--- a/examples/csharp/HelloworldLegacyCsproj/generate_protos.bat
+++ /dev/null
@@ -1,26 +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
-
-set TOOLS_PATH=packages\Grpc.Tools.1.14.1\tools\windows_x86
-
-%TOOLS_PATH%\protoc.exe -I../../protos --csharp_out Greeter ../../protos/helloworld.proto --grpc_out Greeter --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe
-
-endlocal