Skip to content

Commit

Permalink
Drop support for .NET Core and .NET 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jsakamoto committed Dec 13, 2023
1 parent 2ca8d6a commit 57d8ee0
Show file tree
Hide file tree
Showing 28 changed files with 279 additions and 341 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Install .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
# Install .NET SDK
- name: Setup .NET SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: 5.0.401
dotnet-version: 8.0.x

# Publish the site
- name: Publish
run: dotnet publish SampleSites/Client/SampleSite.Client.csproj -c:Release -o:public -p:GHPages=true -f:net5.0
run: dotnet publish SampleSites/Client/SampleSite.Client.csproj -c:Release -o:public -p:GHPages=true -f:net8.0

# Deploy the site
- name: Deploy
Expand Down
37 changes: 12 additions & 25 deletions SampleSites/Client/Program.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
using System.Threading.Tasks;
using SampleSite.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
using SampleSite.Components;
using Toolbelt.Blazor.Extensions.DependencyInjection;

namespace SampleSite.Client
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");

ConfigureServices(builder.Services);
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

await builder.Build().RunAsync();
}
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddHeadElementHelper();
builder.Services.AddGamepadList(options =>
{
//options.DisableClientScriptAutoInjection = true;
});

private static void ConfigureServices(IServiceCollection services)
{
services.AddHeadElementHelper();
services.AddGamepadList(options =>
{
//options.DisableClientScriptAutoInjection = true;
});
}
}
}
await builder.Build().RunAsync();
25 changes: 19 additions & 6 deletions SampleSites/Client/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,37 @@
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59481/",
"sslPort": 0
"sslPort": 59480
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:59482",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"SampleSite.Client": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:59483;http://localhost:59482",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:59482/"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
28 changes: 20 additions & 8 deletions SampleSites/Client/SampleSite.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.25" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.25" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.14" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BlazorWasmPreRendering.Build" Version="1.0.0-preview.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0" PrivateAssets="all" />
<PackageReference Include="PublishSPAforGitHubPages.Build" Version="1.3.1" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
<PackageReference Include="Toolbelt.Blazor.HeadElement" Version="6.0.0" />
<PackageReference Include="BlazorWasmPreRendering.Build" Version="3.1.0-preview.4" />
<PackageReference Include="PublishSPAforGitHubPages.Build" Version="2.1.1" />
<PackageReference Include="Toolbelt.Blazor.HeadElement" Version="7.3.1" />
</ItemGroup>

<ItemGroup>
<!--<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />-->
<ProjectReference Include="..\Components\SampleSite.Components.csproj" />
</ItemGroup>

Expand Down
61 changes: 61 additions & 0 deletions SampleSites/Client/wwwroot/css/blazor-ui.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#blazor-error-ui {
background: #ffffe0;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
display: none;
left: 0;
padding: .6rem 1.25rem .7rem 1.25rem;
position: fixed;
right: 0;
z-index: 1000
}

#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: .75rem;
top: .5rem
}

.blazor-error-boundary {
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
padding: 1rem 1rem 1rem 3.7rem;
color: white;
}

.blazor-error-boundary::after {
content: "An error has occurred."
}

.loading-progress {
position: relative;
display: block;
width: 8rem;
height: 8rem;
margin: 20vh auto 1rem auto;
}

.loading-progress circle {
fill: none;
stroke: #e0e0e0;
stroke-width: 0.6rem;
transform-origin: 50% 50%;
transform: rotate(-90deg);
}

.loading-progress circle:last-child {
stroke: #1b6ec2;
stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
position: absolute;
text-align: center;
font-weight: bold;
inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
content: var(--blazor-load-percentage-text, "Loading");
}
10 changes: 6 additions & 4 deletions SampleSites/Client/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
<meta name="keywords" content="blazor,gamepad" />
<base href="/" />
<link rel="icon" href="./_content/SampleSite.Components/nupkg-icon.png" />
<!-- style for blazor-error-ui -->
<link rel="stylesheet" href="data:text/css,%23blazor-error-ui%7Bbackground%3A%23ffffe0%3Bbottom%3A0%3Bbox-shadow%3A0%20-1px%202px%20rgba(0%2C0%2C0%2C.2)%3Bdisplay%3Anone%3Bleft%3A0%3Bpadding%3A.6rem%201.25rem%20.7rem%201.25rem%3Bposition%3Afixed%3Bright%3A0%3Bz-index%3A1000%7D%23blazor-error-ui%20.dismiss%7Bcursor%3Apointer%3Bposition%3Aabsolute%3Bright%3A.75rem%3Btop%3A.5rem%7D" />
<link rel="stylesheet" href="css/blazor-ui.css" />
<link rel="stylesheet" href="_content/SampleSite.Components/styles.css" />
</head>

<body>
<div id="app">
<div class="loading">Loading...</div>
<link rel="stylesheet" href="data:text/css,.loading%7Bfont-family%3A'Franklin%20Gothic%20Medium'%2C'Arial%20Narrow'%2CArial%2Csans-serif%3Bcolor%3A%2388a%3Bfont-size%3A18px%3Btext-align%3Acenter%3Bwidth%3A150px%3Bheight%3A150px%3Bposition%3Afixed%3Btop%3A0%3Bbottom%3A0%3Bleft%3A0%3Bright%3A0%3Bmargin%3Aauto%7D.loading%3A%3Aafter%7Bcontent%3A''%3Bborder%3Asolid%2010px%3Bborder-color%3A%2388a%20%23eee%20%23eee%3Bborder-radius%3A60px%3Bposition%3Aabsolute%3Bwidth%3A60px%3Bheight%3A60px%3Btop%3A0%3Bbottom%3A0%3Bleft%3A0%3Bright%3A0%3Bmargin%3Aauto%3Banimation%3Arotation%201.5s%20linear%200s%20infinite%7D%40keyframes%20rotation%7B0%25%7Btransform%3Arotate(45deg)%7D100%25%7Btransform%3Arotate(405deg)%7D%7D" />
<svg class="loading-progress">
<circle r="40%" cx="50%" cy="50%" />
<circle r="40%" cx="50%" cy="50%" />
</svg>
<div class="loading-progress-text"></div>
</div>

<div id="blazor-error-ui">
Expand Down
27 changes: 0 additions & 27 deletions SampleSites/Client31/Properties/launchSettings.json

This file was deleted.

31 changes: 0 additions & 31 deletions SampleSites/Client31/SampleSite.Client.Net31.csproj

This file was deleted.

Empty file.
4 changes: 2 additions & 2 deletions SampleSites/Components/About.razor
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

@code
{
[CascadingParameter] Layout.HeaderLinkType headerLink { get; set; }
[CascadingParameter] Layout.HeaderLinkType? headerLink { get; set; }

protected override void OnInitialized()
{
headerLink.Update("", "", "");
headerLink?.Update("", "", "");
}
}
12 changes: 6 additions & 6 deletions SampleSites/Components/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@

@code
{
[CascadingParameter] Layout.HeaderLinkType headerLink { get; set; }
[CascadingParameter] Layout.HeaderLinkType? headerLink { get; set; }

IEnumerable<Gamepad> Gamepads = new Gamepad[0];
private IEnumerable<Gamepad> Gamepads = new Gamepad[0];

Gamepad Gamepad;
private Gamepad? Gamepad;

System.Timers.Timer Timer = new System.Timers.Timer(50) { Enabled = true };
private System.Timers.Timer Timer = new(interval: 50) { Enabled = true };

const double SpaceBoxSize = 320;
const double SpaceShipSize = 30;
Expand All @@ -85,12 +85,12 @@

protected override void OnInitialized()
{
headerLink.Update("about", "📣", "About");
headerLink?.Update("about", "📣", "About");

Timer.Elapsed += Timer_Elapsed;
}

private async void Timer_Elapsed(object sender, EventArgs args)
private async void Timer_Elapsed(object? sender, EventArgs args)
{
try
{
Expand Down
12 changes: 6 additions & 6 deletions SampleSites/Components/Layout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<div class="site-description">This is the demonstration site of the class library that provides gamepad API access for your Blazor apps.</div>
</div>
<div>
@if (this.HeaderLink.Url != "")
@if (this.HeaderLink?.Url != "")
{
<span class="icon">@this.HeaderLink.Emoji</span>
<a href="@this.HeaderLink.Url">@this.HeaderLink.Text</a>
<span class="icon">@this.HeaderLink?.Emoji</span>
<a href="@this.HeaderLink?.Url">@this.HeaderLink?.Text</a>
}
</div>
</header>
Expand All @@ -33,7 +33,7 @@

@code
{
System.Timers.Timer Timer = new System.Timers.Timer(1000) { Enabled = true };
private System.Timers.Timer Timer = new(interval: 1000) { Enabled = true };

public class HeaderLinkType
{
Expand All @@ -52,15 +52,15 @@
}
}

HeaderLinkType HeaderLink { get; set; }
private HeaderLinkType? HeaderLink { get; set; }

protected override void OnInitialized()
{
HeaderLink = new HeaderLinkType(this as IHandleEvent);
Timer.Elapsed += Timer_Elapsed;
}

private async void Timer_Elapsed(object sender, EventArgs args)
private async void Timer_Elapsed(object? sender, EventArgs args)
{
await this.InvokeAsync(() => this.StateHasChanged());
}
Expand Down
Loading

0 comments on commit 57d8ee0

Please sign in to comment.