Skip to content

Commit 81d915a

Browse files
author
Vivien FABING
committed
ADD smallest publishable static Blazor project
1 parent 0e6cdec commit 81d915a

7 files changed

Lines changed: 85 additions & 1 deletion

File tree

App.razor

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@using Microsoft.AspNetCore.Components.Routing
2+
@using SimpleStaticBlazor
3+
4+
<Router AppAssembly="@typeof(Program).Assembly">
5+
<Found Context="routeData">
6+
<RouteView RouteData="@routeData" />
7+
</Found>
8+
<NotFound>
9+
<p>Sorry, there's nothing at this address.</p>
10+
</NotFound>
11+
</Router>

Pages/Index.razor

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@inherits LayoutComponentBase
2+
@page "/"
3+
4+
<div class="main">
5+
<div class="content px-4">
6+
<h1>Hello, world!</h1>
7+
</div>
8+
</div>

Program.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.AspNetCore.Blazor.Hosting;
2+
3+
namespace SimpleStaticBlazor
4+
{
5+
public class Program
6+
{
7+
public static void Main(string[] args)
8+
{
9+
CreateHostBuilder(args).Build().Run();
10+
}
11+
12+
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
13+
BlazorWebAssemblyHost.CreateDefaultBuilder()
14+
.UseBlazorStartup<Startup>();
15+
}
16+
}

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
# SimpleStaticBlazor
1+
# SimpleStaticBlazor
2+
## Publish
3+
4+
`dotnet publish -c release`

SimpleStaticBlazor.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
6+
<LangVersion>7.3</LangVersion>
7+
<RazorLangVersion>3.0</RazorLangVersion>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19465.2" />
12+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
13+
</ItemGroup>
14+
15+
</Project>

Startup.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.AspNetCore.Components.Builder;
2+
using Microsoft.Extensions.DependencyInjection;
3+
4+
namespace SimpleStaticBlazor
5+
{
6+
public class Startup
7+
{
8+
public void ConfigureServices(IServiceCollection services)
9+
{
10+
}
11+
12+
public void Configure(IComponentsApplicationBuilder app)
13+
{
14+
app.AddComponent<App>("app");
15+
}
16+
}
17+
}

wwwroot/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width" />
6+
<title>simple-blazor</title>
7+
<base href="/" />
8+
</head>
9+
<body>
10+
<app>Loading...</app>
11+
12+
<script src="_framework/blazor.webassembly.js"></script>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)