Remove client from gRPC templates (#9078)
This commit is contained in:
parent
b44680762e
commit
67e08728ca
|
|
@ -173,10 +173,9 @@
|
||||||
<BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion>
|
<BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion>
|
||||||
<CastleCorePackageVersion>4.2.1</CastleCorePackageVersion>
|
<CastleCorePackageVersion>4.2.1</CastleCorePackageVersion>
|
||||||
<FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion>
|
<FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion>
|
||||||
<GoogleProtobufPackageVersion>3.6.1</GoogleProtobufPackageVersion>
|
<GoogleProtobufPackageVersion>3.7.0</GoogleProtobufPackageVersion>
|
||||||
<GrpcAspNetCoreServerPackageVersion>0.1.19-pre2</GrpcAspNetCoreServerPackageVersion>
|
<GrpcAspNetCoreServerPackageVersion>0.1.19-pre2</GrpcAspNetCoreServerPackageVersion>
|
||||||
<GrpcCorePackageVersion>1.19.0-pre1</GrpcCorePackageVersion>
|
<GrpcToolsPackageVersion>1.20.0-pre1</GrpcToolsPackageVersion>
|
||||||
<GrpcToolsPackageVersion>1.19.0-pre1</GrpcToolsPackageVersion>
|
|
||||||
<IdentityServer4AspNetIdentityPackageVersion>2.3.0</IdentityServer4AspNetIdentityPackageVersion>
|
<IdentityServer4AspNetIdentityPackageVersion>2.3.0</IdentityServer4AspNetIdentityPackageVersion>
|
||||||
<IdentityServer4EntityFrameworkPackageVersion>2.3.0</IdentityServer4EntityFrameworkPackageVersion>
|
<IdentityServer4EntityFrameworkPackageVersion>2.3.0</IdentityServer4EntityFrameworkPackageVersion>
|
||||||
<IdentityServer4PackageVersion>2.3.0</IdentityServer4PackageVersion>
|
<IdentityServer4PackageVersion>2.3.0</IdentityServer4PackageVersion>
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ try {
|
||||||
Get-ChildItem "$repoRoot/*.sln" -Recurse `
|
Get-ChildItem "$repoRoot/*.sln" -Recurse `
|
||||||
| ? {
|
| ? {
|
||||||
# These .sln files are used by the templating engine.
|
# These .sln files are used by the templating engine.
|
||||||
($_.Name -ne "RazorComponentsWeb-CSharp.sln") -and ($_.Name -ne "GrpcService-CSharp.sln")
|
($_.Name -ne "RazorComponentsWeb-CSharp.sln")
|
||||||
} `
|
} `
|
||||||
| % {
|
| % {
|
||||||
Write-Host " Checking $(Split-Path -Leaf $_)"
|
Write-Host " Checking $(Split-Path -Leaf $_)"
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
|
||||||
<LangVersion>7.1</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Protobuf Include="..\Protos\*.proto" GrpcServices="Client" />
|
|
||||||
<Content Include="@(Protobuf)" LinkBase="" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Grpc.Core" Version="${GrpcCorePackageVersion}" />
|
|
||||||
<PackageReference Include="Google.Protobuf" Version="${GoogleProtobufPackageVersion}" />
|
|
||||||
|
|
||||||
<PackageReference Include="Grpc.Tools" Version="${GrpcToolsPackageVersion}" PrivateAssets="All" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
|
|
@ -5,8 +5,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Protobuf Include="..\Protos\*.proto" GrpcServices="Server" />
|
<Protobuf Include="Protos\greet.proto" GrpcServices="Server" Generator="MSBuild:Compile"/>
|
||||||
<Content Include="@(Protobuf)" LinkBase="" />
|
<Content Include="@(Protobuf)" />
|
||||||
|
<None Remove="@(Protobuf)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
<GeneratedContentProperties>
|
<GeneratedContentProperties>
|
||||||
GoogleProtobufPackageVersion=$(GoogleProtobufPackageVersion);
|
GoogleProtobufPackageVersion=$(GoogleProtobufPackageVersion);
|
||||||
GrpcAspNetCoreServerPackageVersion=$(GrpcAspNetCoreServerPackageVersion);
|
GrpcAspNetCoreServerPackageVersion=$(GrpcAspNetCoreServerPackageVersion);
|
||||||
GrpcCorePackageVersion=$(GrpcCorePackageVersion);
|
|
||||||
GrpcToolsPackageVersion=$(GrpcToolsPackageVersion);
|
GrpcToolsPackageVersion=$(GrpcToolsPackageVersion);
|
||||||
MicrosoftAspNetCoreMvcRazorRuntimeCompilationPackageVersion=$(MicrosoftAspNetCoreMvcRazorRuntimeCompilationPackageVersion);
|
MicrosoftAspNetCoreMvcRazorRuntimeCompilationPackageVersion=$(MicrosoftAspNetCoreMvcRazorRuntimeCompilationPackageVersion);
|
||||||
MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion);
|
MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion);
|
||||||
|
|
@ -40,8 +39,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<GeneratedContent Include="EmptyWeb-CSharp.csproj.in" OutputPath="content/EmptyWeb-CSharp/Company.WebApplication1.csproj" />
|
<GeneratedContent Include="EmptyWeb-CSharp.csproj.in" OutputPath="content/EmptyWeb-CSharp/Company.WebApplication1.csproj" />
|
||||||
<GeneratedContent Include="EmptyWeb-FSharp.fsproj.in" OutputPath="content/EmptyWeb-FSharp/Company.WebApplication1.fsproj" />
|
<GeneratedContent Include="EmptyWeb-FSharp.fsproj.in" OutputPath="content/EmptyWeb-FSharp/Company.WebApplication1.fsproj" />
|
||||||
<GeneratedContent Include="GrpcService-CSharp.Server.csproj.in" OutputPath="content/GrpcService-CSharp/GrpcService-CSharp.Server/GrpcService-CSharp.Server.csproj" />
|
<GeneratedContent Include="GrpcService-CSharp.csproj.in" OutputPath="content/GrpcService-CSharp/GrpcService-CSharp.csproj" />
|
||||||
<GeneratedContent Include="GrpcService-CSharp.Client.csproj.in" OutputPath="content/GrpcService-CSharp/GrpcService-CSharp.Client/GrpcService-CSharp.Client.csproj" />
|
|
||||||
<GeneratedContent Include="RazorComponentsWeb-CSharp.csproj.in" OutputPath="content/RazorComponentsWeb-CSharp/RazorComponentsWeb-CSharp.csproj" />
|
<GeneratedContent Include="RazorComponentsWeb-CSharp.csproj.in" OutputPath="content/RazorComponentsWeb-CSharp/RazorComponentsWeb-CSharp.csproj" />
|
||||||
<GeneratedContent Include="RazorPagesWeb-CSharp.csproj.in" OutputPath="content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj" />
|
<GeneratedContent Include="RazorPagesWeb-CSharp.csproj.in" OutputPath="content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj" />
|
||||||
<GeneratedContent Include="RazorClassLibrary-CSharp.csproj.in" OutputPath="content/RazorClassLibrary-CSharp/Company.RazorClassLibrary1.csproj" />
|
<GeneratedContent Include="RazorClassLibrary-CSharp.csproj.in" OutputPath="content/RazorClassLibrary-CSharp/Company.RazorClassLibrary1.csproj" />
|
||||||
|
|
|
||||||
|
|
@ -18,24 +18,13 @@
|
||||||
},
|
},
|
||||||
"sourceName": "GrpcService-CSharp",
|
"sourceName": "GrpcService-CSharp",
|
||||||
"preferNameDirectory": true,
|
"preferNameDirectory": true,
|
||||||
"guids": [
|
|
||||||
"4C26868E-5E7C-458D-82E3-040509D0C71F",
|
|
||||||
"5990939C-7E7B-4CFA-86FF-44CA5756498A",
|
|
||||||
"650B3CE7-2E93-4CC4-9F46-466686815EAA"
|
|
||||||
],
|
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"modifiers": [
|
"modifiers": [
|
||||||
{
|
{
|
||||||
"condition": "(ExcludeLaunchSettings)",
|
"condition": "(ExcludeLaunchSettings)",
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"GrpcService-CSharp.Server/Properties/launchSettings.json"
|
"Properties/launchSettings.json"
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
|
||||||
"exclude": [
|
|
||||||
"GrpcService-CSharp.sln"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -73,16 +62,7 @@
|
||||||
},
|
},
|
||||||
"primaryOutputs": [
|
"primaryOutputs": [
|
||||||
{
|
{
|
||||||
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
|
"path": "GrpcService-CSharp.csproj"
|
||||||
"path": "GrpcService-CSharp.sln"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
|
||||||
"path": "GrpcService-CSharp.Server/GrpcService-CSharp.Server.csproj"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
|
||||||
"path": "GrpcService-CSharp.Client/GrpcService-CSharp.Client.csproj"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"defaultName": "GrpcService-CSharp1",
|
"defaultName": "GrpcService-CSharp1",
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Greet;
|
|
||||||
using Grpc.Core;
|
|
||||||
|
|
||||||
namespace GrpcService_CSharp
|
|
||||||
{
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
static async Task Main(string[] args)
|
|
||||||
{
|
|
||||||
// Include port of the gRPC server as an application argument
|
|
||||||
var port = args.Length > 0 ? args[0] : "50051";
|
|
||||||
|
|
||||||
var channel = new Channel("localhost:" + port, ChannelCredentials.Insecure);
|
|
||||||
var client = new Greeter.GreeterClient(channel);
|
|
||||||
|
|
||||||
var reply = await client.SayHelloAsync(new HelloRequest { Name = "GreeterClient" });
|
|
||||||
Console.WriteLine("Greeting: " + reply.Message);
|
|
||||||
|
|
||||||
await channel.ShutdownAsync();
|
|
||||||
|
|
||||||
Console.WriteLine("Press any key to exit...");
|
|
||||||
Console.ReadKey();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 15
|
|
||||||
VisualStudioVersion = 15.0.27130.2027
|
|
||||||
MinimumVisualStudioVersion = 15.0.26124.0
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GrpcService-CSharp.Server", "GrpcService-CSharp.Server\GrpcService-CSharp.Server.csproj", "{650B3CE7-2E93-4CC4-9F46-466686815EAA}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GrpcService-CSharp.Client", "GrpcService-CSharp.Client\GrpcService-CSharp.Client.csproj", "{5990939C-7E7B-4CFA-86FF-44CA5756498A}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {4C26868E-5E7C-458D-82E3-040509D0C71F}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
|
|
@ -30,6 +30,8 @@ namespace GrpcService_CSharp
|
||||||
|
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
|
// 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
|
||||||
endpoints.MapGrpcService<GreeterService>();
|
endpoints.MapGrpcService<GreeterService>();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Templates.Test
|
||||||
public ProjectFactoryFixture ProjectFactory { get; }
|
public ProjectFactoryFixture ProjectFactory { get; }
|
||||||
public ITestOutputHelper Output { get; }
|
public ITestOutputHelper Output { get; }
|
||||||
|
|
||||||
[Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/7973")]
|
[Fact]
|
||||||
public async Task GrpcTemplate()
|
public async Task GrpcTemplate()
|
||||||
{
|
{
|
||||||
Project = await ProjectFactory.GetOrCreateProject("grpc", Output);
|
Project = await ProjectFactory.GetOrCreateProject("grpc", Output);
|
||||||
|
|
@ -35,36 +35,18 @@ namespace Templates.Test
|
||||||
var buildResult = await Project.RunDotNetBuildAsync();
|
var buildResult = await Project.RunDotNetBuildAsync();
|
||||||
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult));
|
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult));
|
||||||
|
|
||||||
using (var serverProcess = Project.StartBuiltServerAsync())
|
using (var serverProcess = Project.StartBuiltProjectAsync())
|
||||||
{
|
{
|
||||||
Assert.False(
|
Assert.False(
|
||||||
serverProcess.Process.HasExited,
|
serverProcess.Process.HasExited,
|
||||||
ErrorMessages.GetFailedProcessMessageOrEmpty("Run built server", Project, serverProcess.Process));
|
ErrorMessages.GetFailedProcessMessageOrEmpty("Run built service", Project, serverProcess.Process));
|
||||||
|
|
||||||
using (var clientProcess = Project.StartBuiltClientAsync(serverProcess))
|
|
||||||
{
|
|
||||||
// Wait for the client to do its thing
|
|
||||||
await Task.Delay(100);
|
|
||||||
Assert.False(
|
|
||||||
clientProcess.Process.HasExited,
|
|
||||||
ErrorMessages.GetFailedProcessMessageOrEmpty("Run built client", Project, clientProcess.Process));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var aspNetProcess = Project.StartPublishedServerAsync())
|
using (var aspNetProcess = Project.StartPublishedProjectAsync())
|
||||||
{
|
{
|
||||||
Assert.False(
|
Assert.False(
|
||||||
aspNetProcess.Process.HasExited,
|
aspNetProcess.Process.HasExited,
|
||||||
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published server", Project, aspNetProcess.Process));
|
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published service", Project, aspNetProcess.Process));
|
||||||
|
|
||||||
using (var clientProcess = Project.StartPublishedClientAsync())
|
|
||||||
{
|
|
||||||
// Wait for the client to do its thing
|
|
||||||
await Task.Delay(100);
|
|
||||||
Assert.False(
|
|
||||||
clientProcess.Process.HasExited,
|
|
||||||
ErrorMessages.GetFailedProcessMessageOrEmpty("Run built client", Project, clientProcess.Process));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue