I have just installed .net6 and wanted to try out the gRPC template to check out on their new minimal hosting model. But once I create the project and directly run it, it returns some error.
The grpc project template:
Program.cs
using CloudTemplateBackend.Services;
var builder = WebApplication.CreateBuilder(args);
// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
// Add services to the container.
builder.Services.AddGrpc();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.MapGrpcService<GreeterService>();
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
app.Run();
The error message:
Severity Code Description Project File Line Suppression State
Error CS1061 'IServiceCollection' does not contain a definition for 'AddGrpc' and no accessible extension method 'AddGrpc' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
Severity Code Description Project File Line Suppression State
Error CS1061 'WebApplication' does not contain a definition for 'MapGrpcService' and no accessible extension method 'MapGrpcService' accepting a first argument of type 'WebApplication' could be found (are you missing a using directive or an assembly reference?)
Severity Code Description Project File Line Suppression State
Error MSB4064 The "AdditionalProtocArguments" parameter is not supported by the "ProtoCompile" task loaded from assembly: Protobuf.MSBuild, Version=0.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad from the path:
Severity Code Description Project File Line Suppression State
Error MSB4063 The "ProtoCompile" task could not be initialized with its input parameters.