diff --git a/test/distrib/csharp/DistribTest/Program.cs b/test/distrib/csharp/DistribTest/Program.cs index bda7b2104d6..79c10ac3a99 100644 --- a/test/distrib/csharp/DistribTest/Program.cs +++ b/test/distrib/csharp/DistribTest/Program.cs @@ -53,6 +53,14 @@ namespace TestGrpcPackage server.ShutdownAsync().Wait(); } } + + // Test that codegen works well in case the .csproj has .proto files + // of the same name, but under different directories (see #17672). + // This method doesn't need to be used, it is enough to check that it builds. + private static object CheckDuplicateProtoFilesAreOk() + { + return new DuplicateProto.MessageFromDuplicateProto(); + } } class GreeterImpl : Greeter.GreeterBase diff --git a/test/distrib/csharp/DistribTest/duplicate_proto/testcodegen.proto b/test/distrib/csharp/DistribTest/duplicate_proto/testcodegen.proto new file mode 100644 index 00000000000..cb767cb8055 --- /dev/null +++ b/test/distrib/csharp/DistribTest/duplicate_proto/testcodegen.proto @@ -0,0 +1,23 @@ +// Copyright 2019 The 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. + +// Test that codegen works well in case the .csproj has .proto files +// of the same name, but under different directories (see #17672). +syntax = "proto3"; + +package duplicate_proto; + +message MessageFromDuplicateProto { + string name = 1; +}