diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc
index 69e2738d53d30bd50aecbfdf03c58611e2548683..4def6c5e31f2b53b950ccd01f62fffafe59142d5 100644
--- a/src/compiler/csharp_generator.cc
+++ b/src/compiler/csharp_generator.cc
@@ -350,10 +350,12 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor *service) {
 
 void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
   out->Print("// client stub\n");
+  out->Print("#pragma warning disable 0618\n");
   out->Print(
       "public class $name$ : ClientBase<$name$>, $interface$\n",
       "name", GetClientClassName(service),
       "interface", GetClientInterfaceName(service));
+  out->Print("#pragma warning restore 0618\n");
   out->Print("{\n");
   out->Indent();
 
@@ -480,10 +482,12 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service,
                                bool use_server_class) {
   out->Print(
       "// creates service definition that can be registered with a server\n");
+  out->Print("#pragma warning disable 0618\n");
   out->Print(
       "public static ServerServiceDefinition BindService($interface$ serviceImpl)\n",
       "interface", use_server_class ? GetServerClassName(service) :
           GetServerInterfaceName(service));
+  out->Print("#pragma warning restore 0618\n");
   out->Print("{\n");
   out->Indent();