Skip to content

Commit b322b98

Browse files
authored
Merge pull request #211 from Yubico/bug/193-nativeshims
fix(net47): NativeShims correctly outputs net47 dlls in the correct folders
2 parents ddf77a2 + 105b454 commit b322b98

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

Yubico.Core/src/Yubico/PlatformInterop/Libraries.Net47.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
using System;
1818
using System.IO;
19+
using System.Runtime.InteropServices;
1920

2021
namespace Yubico.PlatformInterop
2122
{
@@ -72,9 +73,13 @@ private static class Net47Implementation
7273
private static string NativeShimsPath =>
7374
Path.Combine(
7475
AppDomain.CurrentDomain.BaseDirectory,
75-
Environment.Is64BitProcess
76-
? "x64"
77-
: "x86",
76+
RuntimeInformation.OSArchitecture switch
77+
{
78+
Architecture.X86 => "x86",
79+
Architecture.X64 => "x64",
80+
Architecture.Arm64 => "arm64",
81+
var unsupportedArch => throw new ArgumentOutOfRangeException($"Architecture {unsupportedArch } is not supported!")
82+
},
7883
NativeShims);
7984

8085
/// <summary>

Yubico.NativeShims/msbuild/Yubico.NativeShims.targets

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!-- x86 -->
1010
<ItemGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X86' OR '$(Platform)' == 'x86'">
1111
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\Yubico.NativeShims.dll">
12-
<Link>Yubico.NativeShims.dll</Link>
12+
<Link>x86\Yubico.NativeShims.dll</Link>
1313
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1414
<Visible>false</Visible>
1515
</Content>
@@ -18,16 +18,16 @@
1818
<!-- x64 -->
1919
<ItemGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64' OR '$(Platform)' == 'x64'">
2020
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\Yubico.NativeShims.dll">
21-
<Link>Yubico.NativeShims.dll</Link>
21+
<Link>x64\Yubico.NativeShims.dll</Link>
2222
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2323
<Visible>false</Visible>
2424
</Content>
2525
</ItemGroup>
2626

2727
<!-- Arm64 -->
28-
<ItemGroup Condition="'$(Platform)' == 'arm64'">
28+
<ItemGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64' OR '$(Platform)' == 'arm64'">
2929
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64\native\Yubico.NativeShims.dll">
30-
<Link>Yubico.NativeShims.dll</Link>
30+
<Link>arm64\Yubico.NativeShims.dll</Link>
3131
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3232
<Visible>false</Visible>
3333
</Content>
@@ -45,5 +45,10 @@
4545
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4646
<Visible>false</Visible>
4747
</Content>
48+
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64\native\Yubico.NativeShims.dll">
49+
<Link>arm64\Yubico.NativeShims.dll</Link>
50+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51+
<Visible>false</Visible>
52+
</Content>
4853
</ItemGroup>
49-
</Project>
54+
</Project>

0 commit comments

Comments
 (0)