Skip to content

Commit

Permalink
Added .NET 9.0 support, removed .NET 6.0 and 7.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Nov 22, 2024
1 parent 920a5ab commit e0d34ab
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/Common.AnsiCli/Common.AnsiCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<AssemblyName>NanoByte.Common.AnsiCli</AssemblyName>
<RootNamespace>NanoByte.Common</RootNamespace>
<Description>Builds upon NanoByte.Common and adds ANSI console output.</Description>
<TargetFrameworks>net462;net472;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net462;net472;net8.0;net9.0</TargetFrameworks>
<OutputPath>..\..\artifacts\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0' Or '$(TargetFramework)'=='net7.0' Or '$(TargetFramework)'=='net8.0'">
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0' Or '$(TargetFramework)'=='net9.0'">
<!-- Run nullability analysis only on annotated frameworks -->
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Common.WinForms/Common.WinForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
<AssemblyName>NanoByte.Common.WinForms</AssemblyName>
<RootNamespace>NanoByte.Common</RootNamespace>
<Description>Builds upon NanoByte.Common and adds various Windows Forms controls with an emphasis on progress reporting and data binding.</Description>
<TargetFrameworks>net20;net40;net45;net462;net472;net6.0-windows;net7.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net20;net40;net45;net462;net472;net8.0-windows;net9.0-windows</TargetFrameworks>
<UseWindowsForms>True</UseWindowsForms>
<OutputPath>..\..\artifacts\$(Configuration)\</OutputPath>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\sgKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildRuntimeType)'=='Core'">
<!-- .NET Core MSBuild does not support legacy ResGen -->
<TargetFrameworks>net462;net472;net6.0-windows;net7.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net472;net8.0-windows;net9.0-windows</TargetFrameworks>
<GenerateResourceUsePreserializedResources>True</GenerateResourceUsePreserializedResources>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-windows' Or '$(TargetFramework)'=='net7.0-windows' Or '$(TargetFramework)'=='net8.0-windows'">
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-windows' Or '$(TargetFramework)'=='net9.0-windows'">
<!-- Run nullability analysis only on annotated frameworks -->
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -26,7 +26,7 @@
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'!='net6.0-windows' And '$(TargetFramework)'!='net7.0-windows' And '$(TargetFramework)'!='net8.0-windows'">
<ItemGroup Condition="'$(TargetFramework)'!='net8.0-windows' And '$(TargetFramework)'!='net9.0-windows'">
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net45' Or '$(TargetFramework)'=='net462' Or '$(TargetFramework)'=='net472'">
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Backports/RequiredMemberAttributes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET7_0_OR_GREATER
#if NET
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.RequiredMemberAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute))]
Expand Down
6 changes: 3 additions & 3 deletions src/Common/Collections/LanguageSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using NanoByte.Common.Values.Design;

#if !NET8_0_OR_GREATER
#if !NET
using System.Runtime.Serialization;
#endif

Expand All @@ -16,7 +16,7 @@ namespace NanoByte.Common.Collections;
/// </summary>
/// <remarks>Uses Unix-style language codes with an underscore (_) separator.</remarks>
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "A Set is a special case of a Collection.")]
#if !NET8_0_OR_GREATER
#if !NET
[Serializable]
#endif
[TypeConverter(typeof(StringConstructorConverter<LanguageSet>))]
Expand Down Expand Up @@ -46,7 +46,7 @@ public LanguageSet(string value)
: this(ParseString(value))
{}

#if !NET8_0_OR_GREATER
#if !NET
protected LanguageSet(SerializationInfo info, StreamingContext context)
: base(info, context)
{}
Expand Down
25 changes: 10 additions & 15 deletions src/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<AssemblyName>NanoByte.Common</AssemblyName>
<RootNamespace>NanoByte.Common</RootNamespace>
<Description>Utility classes and data structures with an emphasis on integration with native Windows and Linux features, network and disk IO, advanced collections and undo/redo logic.</Description>
<TargetFrameworks>net20;net40;net45;net462;net472;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net20;net40;net45;net462;net472;net8.0;net9.0</TargetFrameworks>
<OutputPath>..\..\artifacts\$(Configuration)\</OutputPath>
<NoWarn>$(NoWarn);SYSLIB0014</NoWarn><!-- deprecated WebClient -->
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\sgKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildRuntimeType)'=='Core'">
<!-- .NET Core MSBuild does not support legacy ResGen -->
<TargetFrameworks>net462;net472;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net462;net472;net8.0;net9.0</TargetFrameworks>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0' Or '$(TargetFramework)'=='net7.0' Or '$(TargetFramework)'=='net8.0'">
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0' Or '$(TargetFramework)'=='net9.0'">
<!-- Run nullability analysis only on annotated frameworks -->
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -38,7 +38,7 @@
<Reference Include="System.Net.Http" Pack="False" />
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net6.0' Or '$(TargetFramework)'=='net7.0' Or '$(TargetFramework)'=='net8.0'">
<ItemGroup Condition="'$(TargetFramework)'=='net8.0' Or '$(TargetFramework)'=='net9.0'">
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
Expand All @@ -47,22 +47,17 @@
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="Tmds.DBus" Version="0.21.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'!='net6.0' And '$(TargetFramework)'!='net7.0' And '$(TargetFramework)'!='net8.0'">
<ItemGroup Condition="'$(TargetFramework)'=='net9.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'!='net8.0' And '$(TargetFramework)'!='net9.0'">
<Reference Include="System.Configuration" Pack="False" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/Common/ExitCodeException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Diagnostics;

#if !NET8_0_OR_GREATER
#if !NET
using System.Runtime.Serialization;
#endif

Expand All @@ -16,7 +16,7 @@ namespace NanoByte.Common;
/// <summary>
/// Indicates that a <see cref="Process"/> exited with an unexpected <see cref="Process.ExitCode"/>.
/// </summary>
#if !NET8_0_OR_GREATER
#if !NET
[Serializable]
#endif
public sealed class ExitCodeException : IOException
Expand Down Expand Up @@ -61,7 +61,7 @@ public ExitCodeException(string message, Exception innerException)
{}

#region Serialization
#if !NET8_0_OR_GREATER
#if !NET
/// <summary>
/// Deserializes an exception.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Native/WindowsUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public static string GetFolderPath(SpecialFolder folder)
/// <exception cref="UnauthorizedAccessException">Write access to the file was denied.</exception>
/// <exception cref="Win32Exception">There was a problem writing the file.</exception>
/// <exception cref="PlatformNotSupportedException">This method is called on a platform other than Windows.</exception>
/// <remarks>This method works like <see cref="File.WriteAllBytes"/>, but bypasses .NET's file path validation logic.</remarks>
/// <remarks>This method works like <see cref="File.WriteAllBytes(string,byte[])"/>, but bypasses .NET's file path validation logic.</remarks>
public static void WriteAllBytes([Localizable(false)] string path, byte[] data)
{
#region Sanity checks
Expand Down
6 changes: 3 additions & 3 deletions src/Common/NotAdminException.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Bastian Eicher
// Licensed under the MIT License

#if !NET8_0_OR_GREATER
#if !NET
using System.Runtime.Serialization;
#endif

Expand All @@ -10,7 +10,7 @@ namespace NanoByte.Common;
/// <summary>
/// Like a <see cref="UnauthorizedAccessException"/> but with the additional hint that retrying the operation as an administrator would fix the problem.
/// </summary>
#if !NET8_0_OR_GREATER
#if !NET
[Serializable]
#endif
public class NotAdminException : UnauthorizedAccessException
Expand All @@ -28,7 +28,7 @@ public NotAdminException(string message)
: base(message)
{}

#if !NET8_0_OR_GREATER
#if !NET
/// <inheritdoc/>
protected NotAdminException(SerializationInfo info, StreamingContext context)
: base(info, context)
Expand Down
4 changes: 2 additions & 2 deletions src/Samples/AnsiCli/AnsiCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<AssemblyName>NanoByte.Common.Samples.AnsiCli</AssemblyName>
<RootNamespace>NanoByte.Common.Samples.AnsiCli</RootNamespace>
<Description>Samples for NanoByte.Common.AnsiCli.</Description>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<TargetFrameworks>net48;net9.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<IsPackable>False</IsPackable>
<DeterministicSourcePaths>False</DeterministicSourcePaths>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0'">
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0'">
<!-- Run nullability analysis only on annotated frameworks -->
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Samples/WinForms/WinForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<AssemblyName>NanoByte.Common.Samples.WinForms</AssemblyName>
<RootNamespace>NanoByte.Common.Samples.WinForms</RootNamespace>
<Description>Samples for NanoByte.Common.WinForms.</Description>
<TargetFrameworks>net48;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net48;net9.0-windows</TargetFrameworks>
<OutputType>WinExe</OutputType>
<UseWindowsForms>True</UseWindowsForms>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<IsPackable>False</IsPackable>
<DeterministicSourcePaths>False</DeterministicSourcePaths>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-windows'">
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-windows'">
<!-- Run nullability analysis only on annotated frameworks -->
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -21,7 +21,7 @@
<ItemGroup>
<ProjectReference Include="..\..\Common.WinForms\Common.WinForms.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'!='net8.0-windows'">
<ItemGroup Condition="'$(TargetFramework)'!='net9.0-windows'">
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<!-- Global usings -->
Expand Down
4 changes: 2 additions & 2 deletions src/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<AssemblyName>NanoByte.Common.UnitTests</AssemblyName>
<RootNamespace>NanoByte.Common</RootNamespace>
<Description>Unit test for NanoByte.Common.</Description>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<TargetFrameworks>net48;net9.0</TargetFrameworks>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<IsPackable>False</IsPackable>
<DeterministicSourcePaths>False</DeterministicSourcePaths>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\sgKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework)=='net8.0'">
<PropertyGroup Condition="$(TargetFramework)=='net9.0'">
<!-- Run nullability analysis only on annotated frameworks -->
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ else
fi

# Unit tests (without .NET Framework)
$dotnet test --no-build --logger trx --configuration Release --framework net8.0 UnitTests/UnitTests.csproj
$dotnet test --no-build --logger trx --configuration Release --framework net9.0 UnitTests/UnitTests.csproj

0 comments on commit e0d34ab

Please sign in to comment.