Skip to content

Commit 7434412

Browse files
Update gRPC start tutorial for VS Mac IDE support (#20294)
* Update grpc-start to include VS Mac IDE support * Update aspnetcore/tutorials/grpc/grpc-start.md Co-authored-by: Rick Anderson <[email protected]>
1 parent 7858851 commit 7434412

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

aspnetcore/tutorials/grpc/grpc-start.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ In this tutorial, you:
3636

3737
# [Visual Studio for Mac](#tab/visual-studio-mac)
3838

39-
[!INCLUDE[](~/includes/net-core-prereqs-mac-3.1.md)]
40-
39+
* [Visual Studio for Mac version 8.7 or later](/visualstudio/releasenotes/vs2019-mac-relnotes)
40+
* [!INCLUDE [.NET Core 3.1 SDK](~/includes/3.1-SDK.md)]
4141
---
4242

4343
## Create a gRPC service
@@ -74,19 +74,14 @@ In this tutorial, you:
7474

7575
# [Visual Studio for Mac](#tab/visual-studio-mac)
7676

77-
From a terminal, run the following commands:
78-
79-
```dotnetcli
80-
dotnet new grpc -o GrpcGreeter
81-
cd GrpcGreeter
82-
```
83-
84-
The preceding commands use the [.NET Core CLI](/dotnet/core/tools/dotnet) to create a gRPC service.
77+
* Start Visual Studio for Mac and select **Create a new project**. Alternatively, from the Visual Studio **File** menu, select **New** > **Project**.
78+
* In the **Create a new project** dialog, select **Web and Console** > **App** > **gRPC Service** and select **Next**:
8579

86-
### Open the project
87-
88-
From Visual Studio, select **File** > **Open**, and then select the *GrpcGreeter.csproj* file.
80+
![Create a new project dialog](~/tutorials/grpc/grpc-start/static/cnp-mac.png)
8981

82+
* Select **.NET Core 3.1** for the target framework and click **Next**
83+
* Name the project **GrpcGreeter**. It's important to name the project *GrpcGreeter* so the namespaces will match when you copy and paste code.
84+
* Select **Create**.
9085
---
9186

9287
### Run the service
@@ -188,9 +183,10 @@ dotnet add GrpcGreeterClient.csproj package Grpc.Tools
188183

189184
# [Visual Studio for Mac](#tab/visual-studio-mac)
190185

191-
* Right-click the **Packages** folder in **Solution Pad** > **Add Packages**
186+
* Right-click **GrpcGreeterClient** project in the **Solution Pad** and select **Manage NuGet Packages**
192187
* Enter **Grpc.Net.Client** in the search box.
193188
* Select the **Grpc.Net.Client** package from the results pane and select **Add Package**
189+
* Click the **Accept** button on the **Accept License** dialog.
194190
* Repeat for `Google.Protobuf` and `Grpc.Tools`.
195191

196192
---
@@ -217,7 +213,7 @@ dotnet add GrpcGreeterClient.csproj package Grpc.Tools
217213

218214
# [Visual Studio for Mac](#tab/visual-studio-mac)
219215

220-
Right-click the project and select **Tools** > **Edit File**.
216+
Right-click the project and select **Edit Project File**.
221217

222218
---
223219

@@ -231,7 +227,7 @@ dotnet add GrpcGreeterClient.csproj package Grpc.Tools
231227

232228
### Create the Greeter client
233229

234-
Build the project to create the types in the `GrpcGreeter` namespace. The `GrpcGreeter` types are generated automatically by the build process.
230+
Build the client project to create the types in the `GrpcGreeter` namespace. The `GrpcGreeter` types are generated automatically by the build process.
235231

236232
Update the gRPC client *Program.cs* file with the following code:
237233

@@ -265,6 +261,10 @@ The Greeter client calls the asynchronous `SayHello` method. The result of the `
265261

266262
# [Visual Studio for Mac](#tab/visual-studio-mac)
267263

264+
* Due to the previously mentioned [HTTP/2 TLS issue on macOS workaround](xref:grpc/troubleshoot#unable-to-start-aspnet-core-grpc-app-on-macos), you'll need to update the channel address in the client to "http://localhost:5000". Update line 13 of **GrpcGreeterClient/Program.cs** to read:
265+
```csharp
266+
using var channel = GrpcChannel.ForAddress("http://localhost:5000");
267+
```
268268
* Start the Greeter service.
269269
* Start the client.
270270

aspnetcore/tutorials/grpc/grpc-start/sample/GrpcGreeterClient/Program.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System;
33
using System.Net.Http;
44
using System.Threading.Tasks;
5-
using GrpcGreeter;
65
using Grpc.Net.Client;
76

87
namespace GrpcGreeterClient
Loading

0 commit comments

Comments
 (0)