Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to .NET 8 #121

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/TryMudBlazor.Server/bin/Debug/net7.0/TryMudBlazor.Server.dll",
"program": "${workspaceFolder}/src/TryMudBlazor.Server/bin/Debug/net8.0/TryMudBlazor.Server.dll",
"args": [],
"cwd": "${workspaceFolder}/src/TryMudBlazor.Servver",
"cwd": "${workspaceFolder}/src/TryMudBlazor.Server",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand All @@ -23,7 +23,7 @@
"request": "launch",
"preLaunchTask": "build",
"hosted": true,
"program": "${workspaceFolder}/src/TryMudBlazor.Server/bin/Debug/net7.0/TryMudBlazor.Server.dll",
"program": "${workspaceFolder}/src/TryMudBlazor.Server/bin/Debug/net8.0/TryMudBlazor.Server.dll",
"cwd": "${workspaceFolder}/src/TryMudBlazor.Server",
"browser": "edge",
"env": {
Expand Down
8 changes: 8 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworks);net8.0</TargetFrameworks>
<WasmEnableWebcil>false</WasmEnableWebcil>
</PropertyGroup>

</Project>
1 change: 0 additions & 1 deletion src/MudBlazor.Examples.Data/MudBlazor.Examples.Data.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<!--Used for the periodic table examples-->
Expand Down
11 changes: 5 additions & 6 deletions src/Try.Core/Try.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="6.0.11" />
<PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="6.0.28" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
<PackageReference Include="MudBlazor" Version="*" />
</ItemGroup>

Expand Down
1 change: 0 additions & 1 deletion src/Try.Tests/Try.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 0 additions & 2 deletions src/TryMudBlazor.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public class Program
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddSingleton(serviceProvider => (IJSInProcessRuntime)serviceProvider.GetRequiredService<IJSRuntime>());
builder.Services.AddSingleton(serviceProvider => (IJSUnmarshalledRuntime)serviceProvider.GetRequiredService<IJSRuntime>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</Router>
13 changes: 7 additions & 6 deletions src/TryMudBlazor.Client/TryMudBlazor.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<PublishTrimmed>false</PublishTrimmed>
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="FluentValidation" Version="11.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="8.0.3" />
<PackageReference Include="MudBlazor" Version="*" />
</ItemGroup>

Expand Down
10 changes: 7 additions & 3 deletions src/TryMudBlazor.Client/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
@using Microsoft.AspNetCore.Components.Forms
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using TryMudBlazor.Client.Components
@using TryMudBlazor.Client.Shared

@using MudBlazor
@using MudBlazor
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!DOCTYPE html>
@using Microsoft.AspNetCore.Components.Web
@using TryMudBlazor.Client
<!DOCTYPE html>
<html class="mud-height-full">
<head prefix="og: http://ogp.me/ns#">
<meta charset="utf-8" />
Expand Down Expand Up @@ -28,6 +30,7 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,300,400" rel="stylesheet">
@* <link rel="stylesheet" href="css/app.css" /> *@
<link href="_content/MudBlazor/MudBlazor.min.css?v=#{CACHE_TOKEN}#" rel="stylesheet" />
<link href="css/TryMudBlazor.min.css?v=#{CACHE_TOKEN}#" rel="stylesheet" />
<script src="lib/split.js/split.min.js"></script>
Expand All @@ -42,6 +45,8 @@

gtag('config', 'G-33J60J6E14');
</script>

<HeadOutlet @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)" />
</head>

<body class="mud-height-full">
Expand All @@ -57,7 +62,8 @@
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<Routes @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)" />
<script src="_framework/blazor.web.js"></script>
<script src="_content/MudBlazor/MudBlazor.min.js?v=#{CACHE_TOKEN}#"></script>
<script src="editor/main.js?v=#{CACHE_TOKEN}#"></script>
<script type="text/javascript">
Expand Down
58 changes: 44 additions & 14 deletions src/TryMudBlazor.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,55 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using MudBlazor.Examples.Data;

namespace TryMudBlazor.Server
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();

builder.Services.AddScoped<IPeriodicTableService, PeriodicTableService>();
builder.Services.AddCors(options =>
{
public class Program
{
public static void Main(string[] args)
options.AddDefaultPolicy(
builder =>
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
builder.WithOrigins("https://www.mudblazor.com", "https://mudblazor.com");
});
});

builder.Services.AddControllers();

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebAssemblyDebugging();
}
else
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseRouting();
app.UseCors();
app.UseStaticFiles();
app.MapControllers();
app.UseAntiforgery();

app.MapRazorComponents<TryMudBlazor.Server.App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(Try.UserComponents.__Main).Assembly)
.AddAdditionalAssemblies(typeof(TryMudBlazor.Client._Imports).Assembly);

app.Run();
79 changes: 0 additions & 79 deletions src/TryMudBlazor.Server/Startup.cs

This file was deleted.

13 changes: 6 additions & 7 deletions src/TryMudBlazor.Server/TryMudBlazor.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<UserSecretsId>1fd261c7-898b-40dc-b869-d96c4b787fc1</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.8.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="7.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0" />
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.3" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.3" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions src/UserComponents/Try.UserComponents.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.3" />
</ItemGroup>

</Project>
Loading