Skip to content

Commit

Permalink
Upgrade dotnet 8
Browse files Browse the repository at this point in the history
  • Loading branch information
thuyen authored and thuyen committed May 25, 2024
1 parent 73b290f commit 55318dc
Show file tree
Hide file tree
Showing 32 changed files with 479 additions and 527 deletions.
73 changes: 33 additions & 40 deletions BlazorMovie/Client/BlazorMovie.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TypeScriptTarget>ESNext</TypeScriptTarget>
</PropertyGroup>

<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TypeScriptTarget>ESNext</TypeScriptTarget>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<RunAOTCompilation>false</RunAOTCompilation>
<WasmEnableThreads>false</WasmEnableThreads>
<ImplicitUsings>enable</ImplicitUsings>
<SignAssembly>true</SignAssembly>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<UserSecretsId>2f0b7cb7-4db2-420e-b6d4-dfd9b437d531</UserSecretsId>
<PlatformTarget>AnyCPU</PlatformTarget>
<AnalysisLevel>preview</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.4" />
<PackageReference Include="Microsoft.NET.WebAssembly.Threading" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.4" PrivateAssets="all" />
</ItemGroup>

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

<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>

</Project>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TypeScriptTarget>ESNext</TypeScriptTarget>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TypeScriptTarget>ESNext</TypeScriptTarget>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<RunAOTCompilation>false</RunAOTCompilation>
<WasmEnableThreads>false</WasmEnableThreads>
<ImplicitUsings>enable</ImplicitUsings>
<SignAssembly>true</SignAssembly>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<UserSecretsId>2f0b7cb7-4db2-420e-b6d4-dfd9b437d531</UserSecretsId>
<PlatformTarget>AnyCPU</PlatformTarget>
<AnalysisLevel>preview</AnalysisLevel>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MovieClient\MovieClient.csproj" />
<ProjectReference Include="..\Shared\BlazorMovie.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" />
<PackageReference Include="Microsoft.NET.WebAssembly.Threading" Version="8.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion BlazorMovie/Maui/App.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Maui"
Expand Down
118 changes: 55 additions & 63 deletions BlazorMovie/Maui/BlazorMovie.Maui.csproj
Original file line number Diff line number Diff line change
@@ -1,64 +1,56 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>Maui</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<EnableDefaultCssItems>false</EnableDefaultCssItems>
<UserSecretsId>2f0b7cb7-4db2-420e-b6d4-dfd9b437d531</UserSecretsId>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<SignAssembly>True</SignAssembly>
<AnalysisLevel>preview</AnalysisLevel>

<!-- Display name -->
<ApplicationTitle>Maui</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.maui</ApplicationId>
<ApplicationIdGuid>41307AD0-1D5C-493C-A98D-272C8BA6EA6D</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
</ItemGroup>

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

</Project>
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>Maui</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<EnableDefaultCssItems>false</EnableDefaultCssItems>
<UserSecretsId>2f0b7cb7-4db2-420e-b6d4-dfd9b437d531</UserSecretsId>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<SignAssembly>True</SignAssembly>
<AnalysisLevel>preview</AnalysisLevel>
<!-- Display name -->
<ApplicationTitle>Maui</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.maui</ApplicationId>
<ApplicationIdGuid>41307AD0-1D5C-493C-A98D-272C8BA6EA6D</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MovieClient\MovieClient.csproj" />
<ProjectReference Include="..\Shared\BlazorMovie.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.40" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions BlazorMovie/Maui/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Android.App;
using Android.Content.PM;
using Microsoft.Maui;

namespace Maui.Platforms.Android;

Expand Down
1 change: 1 addition & 0 deletions BlazorMovie/Maui/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Foundation;
using Microsoft.Maui;

namespace Maui;

Expand Down
2 changes: 1 addition & 1 deletion BlazorMovie/Maui/Platforms/Windows/App.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<maui:MauiWinUIApplication
<maui:MauiWinUIApplication
x:Class="Maui.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down
1 change: 1 addition & 0 deletions BlazorMovie/Maui/Platforms/iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Foundation;
using Microsoft.Maui;

namespace Maui;

Expand Down
50 changes: 22 additions & 28 deletions BlazorMovie/MovieClient/MovieClient.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>2f0b7cb7-4db2-420e-b6d4-dfd9b437d531</UserSecretsId>
<SignAssembly>true</SignAssembly>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<Version>5.0</Version>
<AssemblyVersion>5.0.0.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<AnalysisLevel>preview</AnalysisLevel>
</PropertyGroup>


<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

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

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

</Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>2f0b7cb7-4db2-420e-b6d4-dfd9b437d531</UserSecretsId>
<SignAssembly>true</SignAssembly>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<Version>5.0</Version>
<AssemblyVersion>5.0.0.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<AnalysisLevel>preview</AnalysisLevel>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\BlazorMovie.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.5" />
</ItemGroup>
</Project>
16 changes: 8 additions & 8 deletions BlazorMovie/MovieClient/Pages/AdminAccountManagement.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public partial class AdminAccountManagement
/// <summary>
/// It's an async function that calls an API to get a list of accounts, then sorts them by name
/// </summary>
private async Task NameSortParm()
{
index = 0;
sort = sort == "name" ? "nameDesc" : "name";
accs = (await _httpClient.GetFromJsonAsync<List<AccountManagementModel>>($"Admin/AccountManagement/ /{sort}/{index}"))!;
isSearch = false;
searchString = string.Empty;
}
//private async Task NameSortParm()
//{
// index = 0;
// sort = sort == "name" ? "nameDesc" : "name";
// accs = (await _httpClient.GetFromJsonAsync<List<AccountManagementModel>>($"Admin/AccountManagement/ /{sort}/{index}"))!;
// isSearch = false;
// searchString = string.Empty;
//}

/// <summary>
/// It's an async function that gets a list of AccountManagementModel objects from a web api, and
Expand Down
4 changes: 2 additions & 2 deletions BlazorMovie/MovieClient/Pages/EditMovieAdmin.razor
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<MudButton HtmlTag="label"
Variant="Variant.Filled"
Color="Color.Primary"
StartIcon="@Icons.Filled.CloudUpload"
StartIcon="@Icons.Material.Filled.CloudUpload"
for="fileMovieInput">
Upload Movie File
</MudButton>
Expand All @@ -138,7 +138,7 @@
<MudButton HtmlTag="label"
Variant="Variant.Filled"
Color="Color.Secondary"
Icon="@Icons.Filled.Image"
Icon="@Icons.Material.Filled.Image"
for="filePictureInput">
Upload Picture File
</MudButton>
Expand Down
4 changes: 2 additions & 2 deletions BlazorMovie/MovieClient/Pages/EditMovieStudio.razor
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<MudButton HtmlTag="label"
Variant="Variant.Filled"
Color="Color.Primary"
StartIcon="@Icons.Filled.CloudUpload"
StartIcon="@Icons.Material.Filled.CloudUpload"
for="fileMovieInput">
Upload Movie File
</MudButton>
Expand All @@ -125,7 +125,7 @@
<MudButton HtmlTag="label"
Variant="Variant.Filled"
Color="Color.Secondary"
Icon="@Icons.Filled.Image"
Icon="@Icons.Material.Filled.Image"
for="filePictureInput">
Upload Picture File
</MudButton>
Expand Down
2 changes: 1 addition & 1 deletion BlazorMovie/MovieClient/Pages/EditMovieStudio.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public partial class EditMovieStudio
/// </summary>
protected override async Task OnInitializedAsync()
{
movie = await _httpClient.GetFromJsonAsync<MovieModel>($"Studio/EditMovie/{Id}");
movie = await _httpClient.GetFromJsonAsync<MovieModel>($"Studio/EditMovie/{Id}") ?? new();
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions BlazorMovie/MovieClient/Pages/Home.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ protected override async Task OnInitializedAsync()
{
Task? movieTask = Task.Run(async () =>
{
movies = await _httpClient.GetFromJsonAsync<List<MovieModel>>("user/Trending");
movies = await _httpClient.GetFromJsonAsync<List<MovieModel>>("user/Trending") ?? new();
});
char[] tokena = { };
Task? tokenaTask = Task.Run(async () =>
{
tokena = await _httpClient.GetFromJsonAsync<char[]>("User/GetToken");
tokena = await _httpClient.GetFromJsonAsync<char[]>("User/GetToken") ?? [];
});
await Task.WhenAll(movieTask, tokenaTask);
string token = new(tokena);
Expand Down
8 changes: 4 additions & 4 deletions BlazorMovie/MovieClient/Pages/MovieAdmin.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace MovieClient.Pages;
public partial class MovieAdmin
{
/* Initializing the movies variable to an empty list. */
private List<MovieModel>? movies = new();
private List<MovieModel?>? movies = new();
/* Used to keep track of the page number. */
private int index = 0;
/* Initializing the searchString variable to an empty string. */
Expand Down Expand Up @@ -88,15 +88,15 @@ private async Task LoadMore()
index++;
if (isSearch)
{
movies.AddRange(await _httpClient.GetFromJsonAsync<List<MovieModel>>($"admin/Movie/{searchString}//{index}"));
movies?.AddRange(await _httpClient.GetFromJsonAsync<List<MovieModel>>($"admin/Movie/{searchString}//{index}"));
}
else if (sort != null)
{
movies.AddRange(await _httpClient.GetFromJsonAsync<List<MovieModel>>($"admin/Movie/ /{sort}/{index}"));
movies?.AddRange(await _httpClient.GetFromJsonAsync<List<MovieModel>>($"admin/Movie/ /{sort}/{index}"));
}
else
{
movies.AddRange(await _httpClient.GetFromJsonAsync<List<MovieModel>>($"admin/Movie/ / /{index}"));
movies?.AddRange(await _httpClient.GetFromJsonAsync<List<MovieModel>>($"admin/Movie/ / /{index}"));
}
}
}
Loading

0 comments on commit 55318dc

Please sign in to comment.