Skip to content

Commit f0af356

Browse files
committed
Build project with .NET 5 minimum framework requirement
Signed-off-by: Chase Redmon <redmon.chase@gmail.com>
1 parent 75a7ed6 commit f0af356

7 files changed

Lines changed: 21 additions & 4 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55

66
<PropertyGroup>
7-
<TargetFramework>net9.0</TargetFramework>
7+
<LangVersion>latest</LangVersion>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
1010
</PropertyGroup>

Keymapp.NET.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<File Path="README.md" />
2020
<File Path="license.md" />
2121
<File Path="nuget.config" />
22+
<File Path=".github\workflows\release.yml" />
2223
</Folder>
2324
<Folder Name="/src/">
2425
<Project Path="src\Keymapp.NET\Keymapp.NET.csproj" Type="Classic C#">

samples/Sample/Sample.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
45
<OutputType>Exe</OutputType>
56
</PropertyGroup>
67

src/Keymapp.NET/Guard.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Diagnostics.CodeAnalysis;
1+
using Grpc.Net.Client;
2+
using System.Diagnostics.CodeAnalysis;
23
using System.Runtime.CompilerServices;
34

45
namespace Keymapp.NET;
@@ -16,4 +17,12 @@ internal static void ThrowBrightnessOutOfRangeException([CallerMemberName] strin
1617
{
1718
throw new ArgumentOutOfRangeException(name, value, "Brightness steps must be between 1 and 255");
1819
}
20+
21+
internal static void ThrowIfNull(GrpcChannel? channel)
22+
{
23+
if (channel is null)
24+
{
25+
throw new ArgumentNullException(nameof(channel));
26+
}
27+
}
1928
}

src/Keymapp.NET/Keymapp.NET.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Google.Protobuf"/>
59
<PackageReference Include="Grpc.Net.Client"/>

src/Keymapp.NET/KeymappApi.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,15 @@ public sealed class KeymappApi : IKeymappApi
223223
// Explicit constructor for automatic connection
224224
public KeymappApi(GrpcChannel channel)
225225
{
226-
ArgumentNullException.ThrowIfNull(channel);
226+
Guard.ThrowIfNull(channel);
227+
227228
_client ??= new KeyboardService.KeyboardServiceClient(channel);
228229
_lazyConnect = new Lazy<ValueTask>(() => ConnectAsync(channel));
229230
}
230231

231232
public async ValueTask ConnectAsync(GrpcChannel channel, CancellationToken ct = default)
232233
{
233-
ArgumentNullException.ThrowIfNull(channel);
234+
Guard.ThrowIfNull(channel);
234235

235236
try
236237
{

tests/Keymapp.NET.Tests.Integration/Keymapp.NET.Tests.Integration.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3+
<TargetFramework>net9.0</TargetFramework>
34
<IsPackable>false</IsPackable>
45
<RootNamespace>Keymapp.NET.IntegrationTests</RootNamespace>
56
</PropertyGroup>

0 commit comments

Comments
 (0)