Skip to content

Commit 80b8d16

Browse files
committed
Update to .NET 6 and newer libnng
1 parent 31fde6e commit 80b8d16

File tree

9 files changed

+14
-39
lines changed

9 files changed

+14
-39
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ __Goals of nng<span>.</span>NET__:
2727
## Usage
2828

2929
Supports projects targeting:
30-
- .NET 5
31-
- .NET Core App 1.0+
32-
- .NET Standard 1.5+
33-
- [`SuppressUnmanagedCodeSecurity`](https://docs.microsoft.com/en-us/dotnet/api/system.security.suppressunmanagedcodesecurityattribute) is used with .NET Standard 2.0+ for improved PInvoke performance
30+
- .NET 6
3431

3532
[Supported platforms](https://github.com/jeikabu/nng.NETCore/tree/master/nng.NETCore/runtimes):
3633
- Windows Vista or later 32/64-bit (built on Windows Server 2019)

common.targets

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard1.5;netstandard2.0;net5.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0</TargetFrameworks>
55
<RootNamespace>nng</RootNamespace>
66
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
88
<WarningsAsErrors />
99
</PropertyGroup>
1010

11-
<PropertyGroup Condition="'$(TargetFramework)'=='net5.0'">
11+
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0'">
1212
<LangVersion>9.0</LangVersion>
1313
</PropertyGroup>
14-
<PropertyGroup Condition="'$(TargetFramework)'!='net5.0'">
15-
<LangVersion>7.3</LangVersion>
16-
</PropertyGroup>
1714

1815
<PropertyGroup>
1916
<VersionPrefix>1.4.0</VersionPrefix>

nng.NET.Shared/AssemblyLoadContext.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,7 @@ protected override Assembly Load(AssemblyName assemblyName)
4646
if (assemblyName.Name == managedAssemblyName)
4747
{
4848
// Try framework-specific managed assembly path
49-
var path = Path.Combine(assemblyPath, "runtimes", "any", "lib",
50-
#if NETSTANDARD1_5
51-
"netstandard1.5"
52-
#elif NETSTANDARD2_0
53-
"netstandard2.0"
54-
#elif NET5_0
55-
"net5.0"
56-
#else
57-
#error "Unsupported framework?"
58-
#endif
49+
var path = Path.Combine(assemblyPath, "runtimes", "any", "lib", "net6.0"
5950
, managedAssemblyName + ".dll");
6051
if (!File.Exists(path))
6152
{
@@ -72,11 +63,7 @@ protected override IntPtr LoadUnmanagedDll(string unmanagedDllName)
7263
{
7364
if (unmanagedDllName == "nng")
7465
{
75-
#if NETSTANDARD2_0
76-
bool is64bit = Environment.Is64BitProcess;
77-
#else
7866
bool is64bit = (IntPtr.Size == 8);
79-
#endif
8067
string arch = string.Empty;
8168
switch (RuntimeInformation.ProcessArchitecture)
8269
{
@@ -104,7 +91,8 @@ protected override IntPtr LoadUnmanagedDll(string unmanagedDllName)
10491
throw new Exception("Unexpected runtime OS platform: " + RuntimeInformation.OSDescription);
10592
}
10693
}
107-
return IntPtr.Zero;
94+
95+
return base.LoadUnmanagedDll(unmanagedDllName);
10896
}
10997

11098
const string managedAssemblyName = "nng.NET";

nng.NET.Shared/nng.NET.Shared.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,4 @@
1313
<PackageOutputPath>../bin/$(Configuration)</PackageOutputPath>
1414
</PropertyGroup>
1515

16-
<ItemGroup>
17-
<PackageReference Include="system.memory" Version="4.5.4" />
18-
<PackageReference Include="system.valuetuple" Version="4.5.0" />
19-
<PackageReference Include="system.runtime.loader" Version="4.3.0" />
20-
</ItemGroup>
21-
2216
</Project>

nng.NET/nng.NET.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
<NoWarn>$(NoWarn);NU5128</NoWarn>
1818
</PropertyGroup>
1919

20-
<ItemGroup>
21-
<PackageReference Include="system.memory" Version="4.5.4" />
22-
</ItemGroup>
23-
2420
<ItemGroup>
2521
<ProjectReference Include="..\nng.NET.Shared\nng.NET.Shared.csproj">
2622
<Private>false</Private>
-13.9 KB
Binary file not shown.
-28.8 KB
Binary file not shown.

nng.NET/runtimes/linux-x64/native/libnng.so

100644100755
52.1 KB
Binary file not shown.

tests/tests.csproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Import Project="..\nng.NET\build\nng.NET.targets" />
55

66
<PropertyGroup>
7-
<TargetFramework>netcoreapp3.1</TargetFramework>
7+
<TargetFramework>net6.0</TargetFramework>
88

99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1010
<IsPackable>false</IsPackable>
@@ -13,13 +13,16 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="coverlet.msbuild" Version="3.0.2">
16+
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
<PrivateAssets>all</PrivateAssets>
1919
</PackageReference>
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
21-
<PackageReference Include="xunit" Version="2.4.1" />
22-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
20+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
21+
<PackageReference Include="xunit" Version="2.5.0" />
22+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
23+
<PrivateAssets>all</PrivateAssets>
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25+
</PackageReference>
2326
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
2427
</ItemGroup>
2528
<ItemGroup>

0 commit comments

Comments
 (0)