Skip to content

Commit 4130dcb

Browse files
Add a targets file so that native libs are copied correctly
I have previously added this file, but then removed it (before even v1.0). On .NET Core and .NET native libraries are copied to the build output folder correctly. Turns out that on .NET Framework they aren't and this file is needed after all.
1 parent 7ff45c0 commit 4130dcb

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

SharpHook.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
.gitattributes = .gitattributes
1212
.gitignore = .gitignore
1313
.gitmodules = .gitmodules
14+
.github\workflows\build.yml = .github\workflows\build.yml
1415
CHANGELOG.md = CHANGELOG.md
1516
docs\docfx.json = docs\docfx.json
1617
icon.png = icon.png

SharpHook/SharpHook.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
</ItemGroup>
4141

4242
<ItemGroup>
43+
<None Include="SharpHook.targets">
44+
<PackagePath>build/SharpHook.targets</PackagePath>
45+
<Pack>True</Pack>
46+
</None>
4347
<None Include="..\LICENSE">
4448
<Pack>True</Pack>
4549
<PackagePath />

SharpHook/SharpHook.targets

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
3+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(Platform)' == 'x86'">
5+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\win-x86\native\uiohook.dll">
6+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
7+
<TargetPath>uiohook.dll</TargetPath>
8+
<Pack>False</Pack>
9+
</ContentWithTargetPath>
10+
</ItemGroup>
11+
12+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(Platform)' == 'x64'">
13+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\win-x64\native\uiohook.dll">
14+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
15+
<TargetPath>uiohook.dll</TargetPath>
16+
<Pack>False</Pack>
17+
</ContentWithTargetPath>
18+
</ItemGroup>
19+
20+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(Platform)' == 'ARM32'">
21+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\win-arm\native\uiohook.dll">
22+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
23+
<TargetPath>uiohook.dll</TargetPath>
24+
<Pack>False</Pack>
25+
</ContentWithTargetPath>
26+
</ItemGroup>
27+
28+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(Platform)' == 'ARM64'">
29+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\win-arm64\native\uiohook.dll">
30+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31+
<TargetPath>uiohook.dll</TargetPath>
32+
<Pack>False</Pack>
33+
</ContentWithTargetPath>
34+
</ItemGroup>
35+
36+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX')) And '$(Platform)' == 'x64'">
37+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\osx-x64\native\libuiohook.dylib">
38+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
39+
<TargetPath>libuiohook.dylib</TargetPath>
40+
<Pack>False</Pack>
41+
</ContentWithTargetPath>
42+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\osx-x64\native\libuiohook.1.dylib">
43+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
44+
<TargetPath>libuiohook.1.dylib</TargetPath>
45+
<Pack>False</Pack>
46+
</ContentWithTargetPath>
47+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\osx-x64\native\libuiohook.1.2.0.dylib">
48+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
49+
<TargetPath>libuiohook.1.2.0.dylib</TargetPath>
50+
<Pack>False</Pack>
51+
</ContentWithTargetPath>
52+
</ItemGroup>
53+
54+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX')) And '$(Platform)' == 'ARM64'">
55+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\osx-arm64\native\libuiohook.dylib">
56+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
57+
<TargetPath>libuiohook.dylib</TargetPath>
58+
<Pack>False</Pack>
59+
</ContentWithTargetPath>
60+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\osx-arm64\native\libuiohook.1.dylib">
61+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
62+
<TargetPath>libuiohook.1.dylib</TargetPath>
63+
<Pack>False</Pack>
64+
</ContentWithTargetPath>
65+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\osx-arm64\native\libuiohook.1.2.0.dylib">
66+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
67+
<TargetPath>libuiohook.1.2.0.dylib</TargetPath>
68+
<Pack>False</Pack>
69+
</ContentWithTargetPath>
70+
</ItemGroup>
71+
72+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$(Platform)' == 'x64'">
73+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-x64\native\libuiohook.so">
74+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
75+
<TargetPath>libuiohook.so</TargetPath>
76+
<Pack>False</Pack>
77+
</ContentWithTargetPath>
78+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-x64\native\libuiohook.so.1">
79+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
80+
<TargetPath>libuiohook.so.1</TargetPath>
81+
<Pack>False</Pack>
82+
</ContentWithTargetPath>
83+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-x64\native\libuiohook.so.1.2.0">
84+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
85+
<TargetPath>libuiohook.so.1.2.0</TargetPath>
86+
<Pack>False</Pack>
87+
</ContentWithTargetPath>
88+
</ItemGroup>
89+
90+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$(Platform)' == 'ARM32'">
91+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-arm\native\libuiohook.so">
92+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
93+
<TargetPath>libuiohook.so</TargetPath>
94+
<Pack>False</Pack>
95+
</ContentWithTargetPath>
96+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-arm\libuiohook.so.1">
97+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
98+
<TargetPath>libuiohook.so.1</TargetPath>
99+
<Pack>False</Pack>
100+
</ContentWithTargetPath>
101+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-arm\libuiohook.so.1.2.0">
102+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
103+
<TargetPath>libuiohook.so.1.2.0</TargetPath>
104+
<Pack>False</Pack>
105+
</ContentWithTargetPath>
106+
</ItemGroup>
107+
108+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$(Platform)' == 'ARM64'">
109+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-arm64\libuiohook.so">
110+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
111+
<TargetPath>libuiohook.so</TargetPath>
112+
<Pack>False</Pack>
113+
</ContentWithTargetPath>
114+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-arm64\libuiohook.so.1">
115+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
116+
<TargetPath>libuiohook.so.1</TargetPath>
117+
<Pack>False</Pack>
118+
</ContentWithTargetPath>
119+
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)..\runtimes\linux-arm64\libuiohook.so.1.2.0">
120+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
121+
<TargetPath>libuiohook.so.1.2.0</TargetPath>
122+
<Pack>False</Pack>
123+
</ContentWithTargetPath>
124+
</ItemGroup>
125+
</Project>

0 commit comments

Comments
 (0)