Update StandaloneApp to render a component. Remove some redundant code.

This commit is contained in:
Steve Sanderson 2018-01-09 13:45:15 +00:00
parent 6585667ce6
commit 04f9c476a8
5 changed files with 16 additions and 13 deletions

View File

@ -1,6 +1,9 @@
// 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Blazor.Browser.Rendering;
using Microsoft.Blazor.Components;
using Microsoft.Blazor.RenderTree;
using System; using System;
namespace StandaloneApp namespace StandaloneApp
@ -9,7 +12,16 @@ namespace StandaloneApp
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
Console.WriteLine(Microsoft.Blazor.Test.Message); new BrowserRenderer()
.AddComponent("app", new PlaceholderComponent());
}
private class PlaceholderComponent : IComponent
{
public void BuildRenderTree(RenderTreeBuilder builder)
{
builder.AddText("Hello from the placeholder component.");
}
} }
} }
} }

View File

@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Blazor\Microsoft.Blazor.csproj" /> <ProjectReference Include="..\..\src\Microsoft.Blazor\Microsoft.Blazor.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Blazor.Browser\Microsoft.Blazor.Browser.csproj" />
</ItemGroup> </ItemGroup>
<!-- Local alternative to <PackageReference Include="Microsoft.Blazor.Build" /> --> <!-- Local alternative to <PackageReference Include="Microsoft.Blazor.Build" /> -->

View File

@ -5,6 +5,6 @@
<title>Blazor standalone</title> <title>Blazor standalone</title>
</head> </head>
<body> <body>
<h1>Hello</h1> <app>Loading...</app>
</body> </body>
</html> </html>

View File

@ -1,10 +0,0 @@
// 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.
namespace Microsoft.Blazor
{
public static class Test
{
public readonly static string Message = "Hello, world!";
}
}

View File

@ -68,11 +68,11 @@ namespace Microsoft.Blazor.Server.Test
fewer assemblies from the server, and during publishing, illink would remove all the fewer assemblies from the server, and during publishing, illink would remove all the
uncalled implementation code from mscorlib.dll anyway. uncalled implementation code from mscorlib.dll anyway.
*/ */
"/Microsoft.Blazor.Browser.dll",
"/Microsoft.Blazor.dll", "/Microsoft.Blazor.dll",
"/mscorlib.dll", "/mscorlib.dll",
"/netstandard.dll", "/netstandard.dll",
"/StandaloneApp.dll", "/StandaloneApp.dll",
"/System.Console.dll",
"/System.Core.dll", "/System.Core.dll",
"/System.Diagnostics.StackTrace.dll", "/System.Diagnostics.StackTrace.dll",
"/System.dll", "/System.dll",