Factor WebAssembly debugging infrastructure out of Microsoft.AspNetCore.Components.Server (#6519)

* Add empty Blazor.Server project

* Move debugging middleware to Blazor.Server

* Use debugging middleware in Blazor standalone CLI

* Use debugging middleware in Blazor "hosted" sample

* Update artifacts.props
This commit is contained in:
Steve Sanderson 2019-01-11 10:29:43 +00:00 committed by GitHub
parent 5ff7e20c59
commit 827ace6100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 15 deletions

View File

@ -33,6 +33,7 @@ This can be done once #4246 is complete, and done in conjunction with converting
<PackageArtifact Include="Microsoft.AspNetCore.Blazor" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Build" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Cli" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Server" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Templates" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Components.Analyzers" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Components.Browser" Category="ship" />

View File

@ -98,6 +98,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Compon
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.Build", "src\Microsoft.AspNetCore.Components.Build\Microsoft.AspNetCore.Components.Build.csproj", "{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Blazor.Server", "blazor\src\Microsoft.AspNetCore.Blazor.Server\Microsoft.AspNetCore.Blazor.Server.csproj", "{EA44F350-F410-41B4-BA21-00CD31D17384}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -344,6 +346,14 @@ Global
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}.Release|Any CPU.Build.0 = Release|Any CPU
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Release|Any CPU.Build.0 = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -389,6 +399,7 @@ Global
{85813607-297F-4D39-92F7-89379FD80D70} = {32B33872-B599-4913-9F90-EDB5F9E24B18}
{E52F5005-26EA-4764-8ECF-41D324AAA6D9} = {B867E038-B3CE-43E3-9292-61568C46CDEB}
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13} = {B867E038-B3CE-43E3-9292-61568C46CDEB}
{EA44F350-F410-41B4-BA21-00CD31D17384} = {AD41FFD8-2C0C-4F0C-9537-25C2A3A7A1F4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {504DA352-6788-4DC0-8705-82167E72A4D3}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
@ -21,6 +21,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Components.Server\Microsoft.AspNetCore.Components.Server.csproj" />
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Blazor.Server\Microsoft.AspNetCore.Blazor.Server.csproj" />
<ProjectReference Include="..\HostedInAspNet.Client\HostedInAspNet.Client.csproj" />
</ItemGroup>

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder;
@ -21,6 +21,7 @@ namespace HostedInAspNet.Server
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBlazorDebugging();
}
app.UseBlazor<Client.Program>();

View File

@ -20,5 +20,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Components.Server\Microsoft.AspNetCore.Components.Server.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Blazor.Server\Microsoft.AspNetCore.Blazor.Server.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Components.Server;
@ -38,6 +38,7 @@ namespace Microsoft.AspNetCore.Blazor.Cli.Server
var clientAssemblyPath = FindClientAssemblyPath(app);
app.UseBlazor(new BlazorOptions { ClientAssemblyPath = clientAssemblyPath });
app.UseBlazorDebugging();
}
private static void EnableConfiguredPathbase(IApplicationBuilder app, IConfiguration configuration)

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Runtime server features for ASP.NET Core Blazor applications.</Description>
<IsProductPackage>true</IsProductPackage>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
<!-- Used by ws-proxy sources only. Remove this once we're able to consume ws-proxy as a NuGet package. -->
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta7" />
</ItemGroup>
</Project>

View File

@ -14,9 +14,16 @@ using WsProxy;
namespace Microsoft.AspNetCore.Builder
{
internal static class MonoDebugProxyAppBuilderExtensions
/// <summary>
/// Provides infrastructure for debugging Blazor applications.
/// </summary>
public static class BlazorMonoDebugProxyAppBuilderExtensions
{
public static void UseMonoDebugProxy(this IApplicationBuilder app)
/// <summary>
/// Adds middleware for needed for debugging Blazor applications
/// inside Chromium dev tools.
/// </summary>
public static void UseBlazorDebugging(this IApplicationBuilder app)
{
app.UseWebSockets();

View File

@ -87,12 +87,6 @@ namespace Microsoft.AspNetCore.Builder
});
}
// Accept debugger connections
if (config.EnableDebugging)
{
app.UseMonoDebugProxy();
}
// Finally, use SPA fallback routing (serve default page for anything else,
// excluding /_framework/*)
app.MapWhen(IsNotFrameworkDir, childAppBuilder =>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
@ -17,9 +17,6 @@
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="$(AspNetCorePackageVersion)" />
<!-- Used by ws-proxy sources only. Remove this once we're able to consume ws-proxy as a NuGet package. -->
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta7" />
</ItemGroup>
<ItemGroup>