When I run:
dotnet publish -c Release -o out
I get:
google/protobuf/Timestamp.proto : error : File not found. [/app/StorageService.GRPC.Server/StorageService.GRPC.Server.csproj] Protos/candidate.proto(4,1): error : Import "google/protobuf/Timestamp.proto" was not found or had errors. [/app/StorageService.GRPC.Server/StorageService.GRPC.Server.csproj] Protos/candidate.proto(107,3): error : "google.protobuf.Timestamp" is not defined. [/app/StorageService.GRPC.Server/StorageService.GRPC.Server.csproj]
This is my /usr/local/include/google/protobuf
:
And this is my /usr/local/bin/
:
All are done in the docker image which comes from this dockerfile:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app
RUN apt-get update && apt-get install -y protobuf-compiler libprotobuf-dev protobuf-c-compiler
COPY *.sln .
COPY Domain/*.csproj ./Domain/
COPY Application/*.csproj ./Application/
COPY Infrastructure/*.csproj ./Infrastructure/
COPY StorageService.GRPC.Server/*.csproj ./StorageService.GRPC.Server/
COPY BOM.StorageService/*.csproj ./BOM.StorageService/
COPY Test.BOM.StorageService/*.csproj ./Test.BOM.StorageService/
RUN dotnet restore
COPY StorageService.GRPC.Server/Protos /app/Protos
COPY . ./
COPY StorageService.GRPC.Server/Protos/include/ /usr/local/include/
COPY StorageService.GRPC.Server/Protos/bin/ /usr/local/bin/
I solved it. In windows google/protobuf/Timestamp.proto
is ok but when you want to deploy on linux and because linux is case-sensitive, you should import :
google/protobuf/timestamp.proto