Skip to content

How to use this in a CMake C# project? #2517

Open
@bebuch

Description

@bebuch

I need to write a simple gRPC server for my Proto file in C#. Unfortunately, I have very little experience with C#. I am a C++ developer.

For internal project reasons, I would like to use CMake. What should a minimal project look like in which a gRPC server is implemented with grpc-dotnet?

It would be great if you could add a CMake project to the examples directory.

My current state is:

cmake_minimum_required(VERSION 3.11)

set(CMAKE_GENERATOR_PLATFORM Win32)
set(CMAKE_DOTNET_SDK "Microsoft.NET.Sdk")
set(CMAKE_DOTNET_TARGET_FRAMEWORK "net8.0")
set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.8")

project(AppName LANGUAGES CSharp)

file(GLOB SOURCE_FILES "*.cs")
add_executable(App ${SOURCE_FILES})
set_target_properties(App PROPERTIES VS_DOTNET_REFERENCE_Grpc_AspNetCore "Grpc.AspNetCore")

This enables me to create a VS Solution the I can open with Visual Studio. There I need to install Grpc.AspNetCore via right click on the project / Manage NuGet Packages.

I didn't find out yet how to add the Proto file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions