.Net 5 ASP.Net GRPC Service on Mac using Visual Studio Code detected linux as OS

I downloaded the newest .Net SDK, 5.0.100, and should check out grpc service. Since I am using Mac, my editor of choice is Visual Studio Code (both the stable version and insider version). When I opened the project, omnisharp failed with a protobuf error. Looking closer at the error message, I could see that it was looking in the linux_x64 directory and not the macosx_x64 directory for the protobuf directory.

        Failed to load project file '/Users/teislindemark/Documents/Private/Test/Test.csproj'.
/Users/teislindemark/.nuget/packages/grpc.tools/2.32.0/build/_protobuf/Google.Protobuf.Tools.targets(280,5): Error: "/Users/teislindemark/.nuget/packages/grpc.tools/2.32.0/tools/linux_x64/protoc" exited with code 255.

Since this looked like a OmniSharp bug, I went to the Github repository for that project and started looking if anyone had reported something similar or the same. An issue reported an issue on windows gave me the idea to set a property myself. Then I found that the OS could be set as a property in the project file, so I then created a new property group in my project file and specified the correct operating system. I also specified the cpu option, but I do not thing that is needed since it already was picking up x64.


When this was done, my project loaded fine in Visual Studio Code on my Mac and I could continue checking out and be more familiar with ASP.Net Grpc service.

Happy coding!

Teis Lindemark

Read more posts by this author.