Skip to content

Commit e2f91e3

Browse files
Fix build errors by modernizing DemoApp.Client to .NET 8.0 (#71)
* Update build.yml * Update build.yml * fix demoapp * Fix build errors by modernizing DemoApp.Client to use .NET 8.0 and Blazor WebAssembly - Updated DemoApp.Client.csproj to use Microsoft.NET.Sdk.BlazorWebAssembly and .NET 8.0 - Modernized Program.cs to use WebAssemblyHostBuilder pattern - Removed obsolete Startup.cs file - Updated GitVersion.yml configuration - Fixed DemoApp.Server target framework to net8.0 --------- Co-authored-by: Ivan Sanz Carasa <ivansanzcarasa@gmail.com>
1 parent 774b708 commit e2f91e3

6 files changed

Lines changed: 26 additions & 40 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414

1515
- name: Setup .NET Core
1616
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: '8.x.x'
19+
dotnet-quality: 'preview'
1720

1821
- name: Build with dotnet
1922
run: dotnet build --configuration Release .\\src\\Blazor-Analytics.sln

GitVersion.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tag-prefix: '[vV]'
66
branches:
77
master:
88
mode: ContinuousDeployment
9-
tag: beta
9+
label: beta
1010
regex: master$
1111
increment: minor
1212
source-branches:
@@ -17,7 +17,7 @@ branches:
1717
feature:
1818
mode: ContinuousDeployment
1919
regex: features?[/-]
20-
tag: useBranchName
20+
label: useBranchName
2121
increment: Inherit
2222
source-branches:
2323
- master
@@ -27,7 +27,7 @@ branches:
2727
task:
2828
mode: ContinuousDeployment
2929
regex: tasks?[/-]
30-
tag: useBranchName
30+
label: useBranchName
3131
increment: Inherit
3232
source-branches:
3333
- master
@@ -37,9 +37,10 @@ branches:
3737
hotfix:
3838
mode: ContinuousDeployment
3939
regex: hotfix[/-]
40-
tag: 'patch'
40+
label: 'patch'
4141
increment: Patch
42-
prevent-increment-of-merged-branch-version: true
42+
prevent-increment:
43+
of-merged-branch: true
4344
source-branches:
4445
- master
4546
- feature
@@ -49,7 +50,7 @@ branches:
4950
bugfix:
5051
mode: ContinuousDeployment
5152
regex: bugfixs?[/-]
52-
tag: useBranchName
53+
label: useBranchName
5354
increment: Inherit
5455
source-branches:
5556
- master

demo/DemoApp/DemoApp.Client/DemoApp.Client.csproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
<RazorLangVersion>3.0</RazorLangVersion>
4+
<TargetFramework>net8.0</TargetFramework>
65
</PropertyGroup>
76

87
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19465.2" />
10-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
11-
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
12-
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
8+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
9+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
1310
</ItemGroup>
1411

1512
<ItemGroup>
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
using Microsoft.AspNetCore.Blazor.Hosting;
1+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
2+
using Microsoft.Extensions.DependencyInjection;
3+
using Blazor.Analytics;
4+
using System.Threading.Tasks;
25

36
namespace DemoApp.Client
47
{
58
public class Program
69
{
7-
public static void Main(string[] args)
10+
public static async Task Main(string[] args)
811
{
9-
CreateHostBuilder(args).Build().Run();
10-
}
12+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
13+
builder.RootComponents.Add<App>("#app");
14+
15+
builder.Services.AddGoogleAnalytics("UA-111742878-2");
1116

12-
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
13-
BlazorWebAssemblyHost.CreateDefaultBuilder()
14-
.UseBlazorStartup<Startup>();
17+
await builder.Build().RunAsync();
18+
}
1519
}
1620
}

demo/DemoApp/DemoApp.Client/Startup.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

demo/DemoApp/DemoApp.Server/DemoApp.Server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

0 commit comments

Comments
 (0)