Begin on DevHost and sample of standalone app

This commit is contained in:
Steve Sanderson 2017-12-06 23:17:23 +00:00
parent 3688d12ab7
commit a63b695db8
9 changed files with 178 additions and 0 deletions

View File

@ -49,6 +49,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoSanityClient", "samples
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Blazor.Browser", "src\Microsoft.Blazor.Browser\Microsoft.Blazor.Browser.csproj", "{58D2DF2E-4181-4B16-9C69-A3F3EDB89B28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Blazor.DevHost", "src\Microsoft.Blazor.DevHost\Microsoft.Blazor.DevHost.csproj", "{EE690312-2353-4DD0-9250-EE5EDAC6D4F7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorStandalone", "samples\BlazorStandalone\BlazorStandalone.csproj", "{754BBACA-E05B-4DAE-ACFC-1B3B429AE43F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -87,6 +91,14 @@ Global
{58D2DF2E-4181-4B16-9C69-A3F3EDB89B28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58D2DF2E-4181-4B16-9C69-A3F3EDB89B28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58D2DF2E-4181-4B16-9C69-A3F3EDB89B28}.Release|Any CPU.Build.0 = Release|Any CPU
{EE690312-2353-4DD0-9250-EE5EDAC6D4F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE690312-2353-4DD0-9250-EE5EDAC6D4F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE690312-2353-4DD0-9250-EE5EDAC6D4F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE690312-2353-4DD0-9250-EE5EDAC6D4F7}.Release|Any CPU.Build.0 = Release|Any CPU
{754BBACA-E05B-4DAE-ACFC-1B3B429AE43F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{754BBACA-E05B-4DAE-ACFC-1B3B429AE43F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{754BBACA-E05B-4DAE-ACFC-1B3B429AE43F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{754BBACA-E05B-4DAE-ACFC-1B3B429AE43F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -101,6 +113,8 @@ Global
{5BC2A10D-B6CA-43AE-B73C-2A41AE1039F9} = {ADA3AE29-F6DE-49F6-8C7C-B321508CAE8E}
{06AAAE9E-96DE-4574-97DA-9C4C7D9FE990} = {F5FDD4E5-6A52-4A86-BE5E-5E42CB1DC8DA}
{58D2DF2E-4181-4B16-9C69-A3F3EDB89B28} = {B867E038-B3CE-43E3-9292-61568C46CDEB}
{EE690312-2353-4DD0-9250-EE5EDAC6D4F7} = {B867E038-B3CE-43E3-9292-61568C46CDEB}
{754BBACA-E05B-4DAE-ACFC-1B3B429AE43F} = {F5FDD4E5-6A52-4A86-BE5E-5E42CB1DC8DA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {504DA352-6788-4DC0-8705-82167E72A4D3}

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<!--
The following is an alternative to referencing Microsoft.Blazor.DevHost as
a <DotNetCliToolReference>. This is so that Microsoft.Blazor.DevHost gets
compiled from source.
-->
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Blazor.DevHost\Microsoft.Blazor.DevHost.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>
<PropertyGroup>
<RunArguments>run --project ..\..\src\Microsoft.Blazor.DevHost --no-build serve</RunArguments>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,15 @@
// 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 System;
namespace BlazorStandalone
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
}
}
}

View File

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5000/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorStandalone": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000/"
}
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType>
<StartupObject>Microsoft.Blazor.DevHost.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Blazor.Server\Microsoft.Blazor.Server.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,32 @@
// 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 System;
using System.Linq;
namespace Microsoft.Blazor.DevHost
{
internal class Program
{
static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: dotnet blazor <command>");
return 1;
}
var command = args[0];
var remainingArgs = args.Skip(1).ToArray();
switch (command.ToLowerInvariant())
{
case "serve":
Server.Program.Main(remainingArgs);
return 0;
default:
throw new InvalidOperationException($"Unknown command: {command}");
}
}
}
}

View File

@ -0,0 +1,21 @@
// 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;
using Microsoft.AspNetCore.Hosting;
namespace Microsoft.Blazor.DevHost.Server
{
internal class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}

View File

@ -0,0 +1,24 @@
// 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;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.Blazor.DevHost.Server
{
internal class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddRouting();
}
public void Configure(IApplicationBuilder app)
{
app.UseDeveloperExceptionPage();
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseBlazor();
}
}
}