Skip to content

Commit

Permalink
Merge pull request #346 from MADE-Apps/dotnet-upgrade
Browse files Browse the repository at this point in the history
Upgrade to support .NET 7 & 8
  • Loading branch information
tom-made authored Dec 29, 2023
2 parents 1201b97 + b135684 commit d80c03e
Show file tree
Hide file tree
Showing 24 changed files with 137 additions and 170 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,20 @@ jobs:
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh

- name: Setup .NET 5.0
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

- name: Setup .NET 6.0
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 7.0.x

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore $SOLUTION
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ jobs:
with:
dotnet-version: 6.0.x

- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2

Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/MADE.Data.Converters/MADE.Data.Converters.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;uap10.0.17763</TargetFrameworks>
<TargetFrameworks>netstandard2.0;uap10.0.19041</TargetFrameworks>
<Product>MADE.NET Data Converters</Product>
<Description>
MADE.NET Data Converters provide out-of-the-box value converters for taking values of one type and changing them to another.
Expand Down
18 changes: 14 additions & 4 deletions src/MADE.Data.EFCore/MADE.Data.EFCore.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Product>MADE.NET for EF Core</Product>
<Description>
MADE.NET for EF Core builds on the base Entity Framework library to provide base classes and helpers for maintaining data in databases.
</Description>
<PackageTags>MADE EFCore Entity Framework Extensions Queryable DbContext</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.15.2" />
<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.25" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.101.1.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.14" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="7.101.1.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="8.101.1.3" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/MADE.Data.Serialization/MADE.Data.Serialization.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.5.2" />
<PackageReference Include="FluentValidation" Version="11.9.0" />
</ItemGroup>

<ItemGroup>
Expand Down
47 changes: 3 additions & 44 deletions src/MADE.Diagnostics/AppDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ namespace MADE.Diagnostics
/// </summary>
public class AppDiagnostics : IAppDiagnostics
{
#if __ANDROID__
private UncaughtExceptionHandler javaExceptionHandler;
#endif

/// <summary>
/// Initializes a new instance of the <see cref="AppDiagnostics"/> class.
/// </summary>
Expand Down Expand Up @@ -63,17 +59,9 @@ public async Task StartRecordingDiagnosticsAsync()

#if WINDOWS_UWP
Windows.UI.Xaml.Application.Current.UnhandledException += this.OnAppUnhandledException;
#elif NETSTANDARD2_0 || __ANDROID__ || __IOS__
#elif NETSTANDARD2_0
AppDomain.CurrentDomain.UnhandledException += this.OnAppUnhandledException;
#endif

#if __ANDROID__
Android.Runtime.AndroidEnvironment.UnhandledExceptionRaiser += this.OnAndroidAppUnhandledException;

this.javaExceptionHandler = new UncaughtExceptionHandler(this.OnJavaUncaughtException);
Java.Lang.Thread.DefaultUncaughtExceptionHandler = this.javaExceptionHandler;
#endif

TaskScheduler.UnobservedTaskException += this.OnTaskUnobservedException;

await Task.CompletedTask;
Expand All @@ -91,14 +79,9 @@ public void StopRecordingDiagnostics()

#if WINDOWS_UWP
Windows.UI.Xaml.Application.Current.UnhandledException -= this.OnAppUnhandledException;
#elif NETSTANDARD2_0 || __ANDROID__ || __IOS__
#elif NETSTANDARD2_0
AppDomain.CurrentDomain.UnhandledException -= this.OnAppUnhandledException;
#endif

#if __ANDROID__
Android.Runtime.AndroidEnvironment.UnhandledExceptionRaiser -= this.OnAndroidAppUnhandledException;
#endif

TaskScheduler.UnobservedTaskException -= this.OnTaskUnobservedException;

this.IsRecordingDiagnostics = false;
Expand Down Expand Up @@ -128,7 +111,7 @@ private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExc
? $"An unhandled exception was thrown. Error: {args.Exception}"
: "An unhandled exception was thrown. Error: No exception information was available.");
}
#elif NETSTANDARD2_0 || __ANDROID__ || __IOS__
#elif NETSTANDARD2_0
private void OnAppUnhandledException(object sender, UnhandledExceptionEventArgs args)
{
if (args.IsTerminating)
Expand All @@ -149,29 +132,5 @@ private void OnAppUnhandledException(object sender, UnhandledExceptionEventArgs
this.ExceptionObserved?.Invoke(this, new ExceptionObservedEventArgs(correlationId, ex));
}
#endif

#if __ANDROID__
private void OnAndroidAppUnhandledException(object sender, Android.Runtime.RaiseThrowableEventArgs args)
{
args.Handled = true;

var correlationId = Guid.NewGuid();

this.EventLogger.WriteCritical($"An unhandled exception was thrown. Correlation ID: {correlationId}. Error: {args.Exception}.");
this.ExceptionObserved?.Invoke(this, new ExceptionObservedEventArgs(correlationId, args.Exception));
}

private void OnJavaUncaughtException(Exception ex)
{
var correlationId = Guid.NewGuid();

this.EventLogger.WriteCritical(
ex != null
? $"An unhandled exception was thrown. Correlation ID: {correlationId}. Error: {ex}."
: $"An unhandled exception was thrown. Correlation ID: {correlationId}. Error: No exception information was available.");

this.ExceptionObserved?.Invoke(this, new ExceptionObservedEventArgs(correlationId, ex));
}
#endif
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions src/MADE.Diagnostics/MADE.Diagnostics.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;uap10.0.17763;xamarinios10;xamarinmac20;MonoAndroid10.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;uap10.0.19041</TargetFrameworks>
<Product>MADE.NET Diagnostics</Product>
<Description>
MADE.NET Diagnostics provides helpers to make debugging and logging results in your applications easier.
</Description>
<PackageTags>MADE Diagnostics Extensions Logging EventLog Logger Exception Stopwatch</PackageTags>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='uap10.0.17763' Or '$(TargetFramework)'=='xamarinios10' Or '$(TargetFramework)'=='MonoAndroid10.0'">
<ItemGroup Condition="'$(TargetFramework)'=='uap10.0.19041'">
<PackageReference Include="XPlat.Storage" Version="1.8.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/MADE.Networking/MADE.Networking.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/MADE.Web.Mvc/MADE.Web.Mvc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Product>MADE.NET for ASP.NET Core MVC</Product>
<Description>
MADE.NET for ASP.NET Core MVC builds on features of ASP.NET Core MVC to provide additional MVC-specific functionality to improve your web applications.
Expand All @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 7 additions & 8 deletions src/MADE.Web/Extensions/ApiVersioningExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

namespace MADE.Web.Extensions
{
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Versioning;
using Asp.Versioning;
using Microsoft.Extensions.DependencyInjection;

/// <summary>
Expand All @@ -24,15 +23,15 @@ public static IServiceCollection AddApiVersionSupport(
int defaultMajor = 1,
int defaultMinor = 0)
{
services.AddVersionedApiExplorer(options => options.GroupNameFormat = "'v'VVV");

services.AddApiVersioning(options =>
var apiVersioningBuilder = services.AddApiVersioning(options =>
{
options.DefaultApiVersion = new ApiVersion(defaultMajor, defaultMinor);
options.AssumeDefaultVersionWhenUnspecified = true;
options.ReportApiVersions = true;
});

apiVersioningBuilder.AddApiExplorer(options => options.GroupNameFormat = "'v'VVV");

return services;
}

Expand All @@ -50,16 +49,16 @@ public static IServiceCollection AddApiVersionHeaderSupport(
int defaultMajor = 1,
int defaultMinor = 0)
{
services.AddVersionedApiExplorer(options => options.GroupNameFormat = "'v'VVV");

services.AddApiVersioning(options =>
var apiVersioningBuilder = services.AddApiVersioning(options =>
{
options.DefaultApiVersion = new ApiVersion(defaultMajor, defaultMinor);
options.AssumeDefaultVersionWhenUnspecified = true;
options.ReportApiVersions = true;
options.ApiVersionReader = new HeaderApiVersionReader(apiHeaderName);
});

apiVersioningBuilder.AddApiExplorer(options => options.GroupNameFormat = "'v'VVV");

return services;
}
}
Expand Down
21 changes: 17 additions & 4 deletions src/MADE.Web/MADE.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Product>MADE.NET for ASP.NET Core</Product>
<Description>
MADE.NET for ASP.NET Core builds on features of ASP.NET Core to provide better support for your web API or MVC applications, including standardized pagination support, global authenticated user accessor, standardized exception handling with JSON responses, and API versioning.
Expand All @@ -14,9 +14,22 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="Asp.Versioning.Mvc" Version="6.4.1" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="6.4.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
<PackageReference Include="Asp.Versioning.Mvc" Version="7.1.1" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="7.1.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<PackageReference Include="Asp.Versioning.Mvc" Version="8.0.0" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

</Project>
Loading

0 comments on commit d80c03e

Please sign in to comment.