From 4bddb8fc02213b1da50ffbdda49b7b57a1ed649c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Fri, 17 Nov 2023 13:08:59 +0100 Subject: [PATCH] Added .NET 7 Fixed this dumb nonsense https://github.com/lduchosal/ipnetwork/issues/280 --- .github/workflows/build.yml | 2 +- .github/workflows/publish-to-nuget.yml | 2 +- src/Nefarius.Utilities.AspNetCore.csproj | 6 ++++-- src/Util/NetworkUtil.cs | 8 +++++--- src/WebApplicationBuilderExtensions.cs | 6 ++++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d81b05a..796b980 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: - name: Setup .Net SDK uses: actions/setup-dotnet@v2 with: - dotnet-version: 7.x + dotnet-version: 8.x include-prerelease: false - name: Build diff --git a/.github/workflows/publish-to-nuget.yml b/.github/workflows/publish-to-nuget.yml index 6894cf9..daf7f2d 100644 --- a/.github/workflows/publish-to-nuget.yml +++ b/.github/workflows/publish-to-nuget.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .Net SDK uses: actions/setup-dotnet@v2 with: - dotnet-version: 7.x + dotnet-version: 8.x include-prerelease: false - name: Build diff --git a/src/Nefarius.Utilities.AspNetCore.csproj b/src/Nefarius.Utilities.AspNetCore.csproj index 4674df5..f6c591a 100644 --- a/src/Nefarius.Utilities.AspNetCore.csproj +++ b/src/Nefarius.Utilities.AspNetCore.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net6.0;net7.0;net8.0 true MIT NSS-128x128.png @@ -38,7 +38,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + + IPNetwork2 + diff --git a/src/Util/NetworkUtil.cs b/src/Util/NetworkUtil.cs index fe80174..0347b54 100644 --- a/src/Util/NetworkUtil.cs +++ b/src/Util/NetworkUtil.cs @@ -1,9 +1,11 @@ -using System.Collections.Generic; +extern alias IPNetwork2; +using System.Collections.Generic; using System.Linq; -using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; +using IPNetwork2::System.Net; + namespace Nefarius.Utilities.AspNetCore.Util; internal static class NetworkUtil @@ -15,7 +17,7 @@ public static IEnumerable GetNetworks(NetworkInterfaceType type) n.OperationalStatus == OperationalStatus.Up) // get all operational networks of a given type .Select(n => n.GetIPProperties()) // get the IPs - //.Where(n => n.GatewayAddresses.Any()) + //.Where(n => n.GatewayAddresses.Any()) select item.UnicastAddresses.FirstOrDefault(i => i.Address.AddressFamily == AddressFamily.InterNetwork) into ipInfo diff --git a/src/WebApplicationBuilderExtensions.cs b/src/WebApplicationBuilderExtensions.cs index 0e89d3e..823f1d6 100644 --- a/src/WebApplicationBuilderExtensions.cs +++ b/src/WebApplicationBuilderExtensions.cs @@ -1,4 +1,5 @@ -using System; +extern alias IPNetwork2; +using System; using System.Diagnostics.CodeAnalysis; using System.IO; using System.IO.Compression; @@ -19,7 +20,8 @@ using Serilog.Sinks.File.Archive; using Serilog.Sinks.SystemConsole.Themes; -using IPNetwork = System.Net.IPNetwork; +using IPNetwork = IPNetwork2::System.Net.IPNetwork; + namespace Nefarius.Utilities.AspNetCore;