Skip to content

Commit

Permalink
📦 Upgrade to .NET 7
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontaylordev authored Oct 18, 2022
1 parent 18efaa2 commit 1697638
Show file tree
Hide file tree
Showing 29 changed files with 153 additions and 112 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,3 @@ $RECYCLE.BIN/
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
/deploy/main.parameters.json
2 changes: 1 addition & 1 deletion RapidBlazor.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>

<id>JasonTaylorDev.RapidBlazor</id>
<version>0.9.3</version>
<version>7.0.0</version>
<title>Rapid Blazor Template</title>
<authors>JasonTaylorDev</authors>
<description>Rapid Blazor Template for .NET.</description>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "6.0.402"
"version": "7.0.100-rc.2.22477.23"
}
}
3 changes: 1 addition & 2 deletions setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function CreateWorkloadIdentity {
# Create Azure AD Application Registration
$applicationRegistrationDetails=$(az ad app create --display-name "$ProjectName$environmentName") | ConvertFrom-Json

# Create Federated Credential for ...
# Create federated credentials
$credential = @{
name="$ProjectName$environmentName";
issuer="https://token.actions.githubusercontent.com";
Expand All @@ -36,7 +36,6 @@ function CreateWorkloadIdentity {

$credential | az ad app federated-credential create --id $applicationRegistrationDetails.id --parameters "@-" | Out-Null

# Create Federated Credential for ...
$credential = @{
name="$ProjectName";
issuer="https://token.actions.githubusercontent.com";
Expand Down
10 changes: 5 additions & 5 deletions src/Application/Application.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>RapidBlazor.Application</RootNamespace>
Expand All @@ -12,10 +12,10 @@
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="10.4.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="10.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-rc.2.22472.11" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0-rc.2.22472.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0-rc.2.22472.3" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>RapidBlazor.Domain</RootNamespace>
Expand Down
18 changes: 9 additions & 9 deletions src/Infrastructure/Infrastructure.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>RapidBlazor.Infrastructure</RootNamespace>
Expand All @@ -13,13 +13,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-rc.2.22476.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-rc.2.22476.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-rc.2.22476.2" />
<PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" Version="7.0.0-rc.2.22476.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-rc.2.22472.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-rc.2.22472.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-rc.2.22472.11" />
</ItemGroup>

</Project>
42 changes: 21 additions & 21 deletions src/WebUI/Client/Client.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>RapidBlazor.WebUI.Client</RootNamespace>
<AssemblyName>RapidBlazor.WebUI.Client</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>RapidBlazor.WebUI.Client</RootNamespace>
<AssemblyName>RapidBlazor.WebUI.Client</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blazored.FluentValidation" Version="2.0.3" />
<PackageReference Include="FluentValidation" Version="10.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.9" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Scrutor" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.FluentValidation" Version="2.0.3" />
<PackageReference Include="FluentValidation" Version="10.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-rc.2.22476.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-rc.2.22476.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.0-rc.2.22476.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0-rc.2.22472.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Scrutor" Version="4.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/WebUI/Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddHttpClient("CleanArchitecture.WebUI.ServerAPI", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
builder.Services.AddHttpClient("RapidBlazor.WebUI.ServerAPI", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
.AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();

// Supply HttpClient instances that include access tokens when making requests to the server project
builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient("CleanArchitecture.WebUI.ServerAPI"));
builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient("RapidBlazor.WebUI.ServerAPI"));

builder.Services
.AddApiAuthorization()
Expand Down
6 changes: 3 additions & 3 deletions src/WebUI/Client/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:7569",
"applicationUrl": "http://localhost:5246",
"sslPort": 44376
}
},
"profiles": {
"RapidBlazor.WebUI": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7068;http://localhost:5096",
"applicationUrl": "https://localhost:7124;http://localhost:5083",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
9 changes: 3 additions & 6 deletions src/WebUI/Client/Shared/LoginDisplay.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication

@inject NavigationManager Navigation
@inject SignOutSessionStateManager SignOutManager

<AuthorizeView>
<Authorized>
<a href="authentication/profile">Hello, @context.User.Identity?.Name!</a>
<button class="nav-link btn btn-link" @onclick="BeginSignOut">Log out</button>
<button class="nav-link btn btn-link" @onclick="BeginLogOut">Log out</button>
</Authorized>
<NotAuthorized>
<a href="authentication/register">Register</a>
Expand All @@ -16,9 +14,8 @@
</AuthorizeView>

@code{
private async Task BeginSignOut(MouseEventArgs args)
private void BeginLogOut()
{
await SignOutManager.SetSignOutState();
Navigation.NavigateTo("authentication/logout");
Navigation.NavigateToLogout("authentication/logout");
}
}
2 changes: 1 addition & 1 deletion src/WebUI/Client/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
</div>

<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
Expand Down
6 changes: 6 additions & 0 deletions src/WebUI/Client/Shared/NavMenu.razor.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,10 @@
/* Never collapse the sidebar for wide screens */
display: block;
}

.nav-scrollable {
/* Allow sidebar to scroll for tall menus */
height: calc(100vh - 3.5rem);
overflow-y: auto;
}
}
5 changes: 3 additions & 2 deletions src/WebUI/Client/Shared/RedirectToLogin.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@inject NavigationManager Navigation
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@inject NavigationManager Navigation

@code {
protected override void OnInitialized()
{
Navigation.NavigateTo($"authentication/login?returnUrl={Uri.EscapeDataString(Navigation.Uri)}");
Navigation.NavigateToLogin("authentication/login");
}
}
2 changes: 1 addition & 1 deletion src/WebUI/Client/Shared/SurveyPrompt.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<span class="text-nowrap">
Please take our
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2148851">brief survey</a>
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2186157">brief survey</a>
</span>
and tell us what you think.
</div>
Expand Down
39 changes: 38 additions & 1 deletion src/WebUI/Client/wwwroot/css/app.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
Expand All @@ -18,6 +18,10 @@ a, .btn-link {
border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
padding-top: 1.1rem;
}
Expand Down Expand Up @@ -62,3 +66,36 @@ a, .btn-link {
.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");
}
Binary file removed src/WebUI/Client/wwwroot/favicon.ico
Binary file not shown.
9 changes: 8 additions & 1 deletion src/WebUI/Client/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png" />
<link href="RapidBlazor.WebUI.Client.styles.css" rel="stylesheet" />
</head>

<body>
<div id="app">Loading...</div>
<div id="app">
<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">
An unhandled error has occurred.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public OidcConfigurationController(IClientRequestParametersProvider clientReques
public IClientRequestParametersProvider ClientRequestParametersProvider { get; }

[HttpGet("_configuration/{clientId}")]
public IActionResult GetClientRequestParameters([FromRoute] string clientId)
public IActionResult GetClientRequestParameters([FromRoute]string clientId)
{
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
return Ok(parameters);
Expand Down
4 changes: 2 additions & 2 deletions src/WebUI/Server/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;

namespace RapidBlazor.WebUI.Server.Pages;

Expand Down
3 changes: 1 addition & 2 deletions src/WebUI/Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Azure.Identity;
using Azure.Identity;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using NSwag;
Expand Down Expand Up @@ -56,7 +56,6 @@
builder.Services.AddSingleton<IAuthorizationPolicyProvider, FlexibleAuthorizationPolicyProvider>();

builder.Services.AddApplicationInsightsTelemetry();

var app = builder.Build();

// Initialise and seed the database
Expand Down
6 changes: 3 additions & 3 deletions src/WebUI/Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:7569",
"applicationUrl": "http://localhost:5246",
"sslPort": 44376
}
},
"profiles": {
"RapidBlazor.WebUI.Server": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7068;http://localhost:5096",
"applicationUrl": "https://localhost:7124;http://localhost:5083",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
Loading

0 comments on commit 1697638

Please sign in to comment.