Skip to content

Commit a5bd43a

Browse files
committed
Fix .NET Framework native DLL copy: remove RuntimeIdentifier condition
Modern .NET SDK auto-infers RuntimeIdentifier for .NET Framework Exe projects (e.g., win-x86), so the condition '$(RuntimeIdentifier)' == '' was always false, preventing the Copy target from running. Remove that check and only gate on TargetFrameworkIdentifier != .NETCoreApp. Also remove all diagnostic Message targets and CI debug output.
1 parent f995e00 commit a5bd43a

7 files changed

Lines changed: 7 additions & 49 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,7 @@ jobs:
271271
272272
dotnet restore -p:NativeRid=$RID $EXTRA_ARGS
273273
274-
# Show the FULL g.targets to understand import conditions
275-
echo "=== FULL NuGet .g.targets ==="
276-
cat obj/ConsumptionTest.csproj.nuget.g.targets 2>/dev/null || echo "(not found)"
277-
278-
# Build with diagnostic verbosity and look for our target execution
279-
dotnet build -c Release -p:NativeRid=$RID $EXTRA_ARGS --no-restore -v diagnostic 2>&1 | \
280-
grep -i "CopyWebP\|DiagWebP\|\[WebP\.NativeRuntime" | head -20 || echo "(no target messages found)"
281-
282-
echo "=== Output directory contents ==="
283-
for d in bin/Release/net*/; do
284-
echo "--- $d ---"
285-
ls "$d" 2>/dev/null | head -20
286-
done
274+
dotnet build -c Release -p:NativeRid=$RID $EXTRA_ARGS --no-restore
287275
288276
IFS=';' read -ra FW_ARRAY <<< "$FRAMEWORKS"
289277
FAIL=0

src/Imazen.WebP.NativeRuntime.win-arm64/build/net45/Imazen.WebP.NativeRuntime.win-arm64.targets

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@
44
.NET Core/5+ handles runtimes/ natively via deps.json. -->
55
<Target Name="CopyWebPNativeLibs_win_arm64"
66
AfterTargets="Build"
7-
Condition=" '$(RuntimeIdentifier)' == '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
8-
<Message Importance="high" Text="[WebP.NativeRuntime.win-arm64] Target executing. TFI=$(TargetFrameworkIdentifier) RID=$(RuntimeIdentifier) OutputPath=$(OutputPath)" />
7+
Condition=" '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
98
<ItemGroup>
109
<_WebPNativeFiles_win_arm64 Include="$(MSBuildThisFileDirectory)../../runtimes/win-arm64/native/*" />
1110
</ItemGroup>
12-
<Message Importance="high" Text="[WebP.NativeRuntime.win-arm64] Files found: @(_WebPNativeFiles_win_arm64->'%(Filename)%(Extension)', ', ')" />
1311
<Copy SourceFiles="@(_WebPNativeFiles_win_arm64)"
1412
DestinationFolder="$(OutputPath)"
1513
SkipUnchangedFiles="true" />
1614
</Target>
17-
<Target Name="DiagWebPNativeLibs_win_arm64"
18-
AfterTargets="Build"
19-
Condition=" '$(RuntimeIdentifier)' != '' OR '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
20-
<Message Importance="high" Text="[WebP.NativeRuntime.win-arm64] Target SKIPPED. TFI=$(TargetFrameworkIdentifier)" />
21-
</Target>
2215
</Project>

src/Imazen.WebP.NativeRuntime.win-arm64/buildTransitive/net45/Imazen.WebP.NativeRuntime.win-arm64.targets

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@
44
.NET Core/5+ handles runtimes/ natively via deps.json. -->
55
<Target Name="CopyWebPNativeLibs_win_arm64"
66
AfterTargets="Build"
7-
Condition=" '$(RuntimeIdentifier)' == '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
8-
<Message Importance="high" Text="[WebP.NativeRuntime.win-arm64] Target executing. TFI=$(TargetFrameworkIdentifier) RID=$(RuntimeIdentifier) OutputPath=$(OutputPath)" />
7+
Condition=" '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
98
<ItemGroup>
109
<_WebPNativeFiles_win_arm64 Include="$(MSBuildThisFileDirectory)../../runtimes/win-arm64/native/*" />
1110
</ItemGroup>
12-
<Message Importance="high" Text="[WebP.NativeRuntime.win-arm64] Files found: @(_WebPNativeFiles_win_arm64->'%(Filename)%(Extension)', ', ')" />
1311
<Copy SourceFiles="@(_WebPNativeFiles_win_arm64)"
1412
DestinationFolder="$(OutputPath)"
1513
SkipUnchangedFiles="true" />
1614
</Target>
17-
<Target Name="DiagWebPNativeLibs_win_arm64"
18-
AfterTargets="Build"
19-
Condition=" '$(RuntimeIdentifier)' != '' OR '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
20-
<Message Importance="high" Text="[WebP.NativeRuntime.win-arm64] Target SKIPPED. TFI=$(TargetFrameworkIdentifier)" />
21-
</Target>
2215
</Project>

src/Imazen.WebP.NativeRuntime.win-x64/build/net45/Imazen.WebP.NativeRuntime.win-x64.targets

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,12 @@
44
.NET Core/5+ handles runtimes/ natively via deps.json. -->
55
<Target Name="CopyWebPNativeLibs_win_x64"
66
AfterTargets="Build"
7-
Condition=" '$(RuntimeIdentifier)' == '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
8-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Target executing. TFI=$(TargetFrameworkIdentifier) RID=$(RuntimeIdentifier) OutputPath=$(OutputPath)" />
9-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Source dir: $(MSBuildThisFileDirectory)../../runtimes/win-x64/native/" />
7+
Condition=" '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
108
<ItemGroup>
119
<_WebPNativeFiles_win_x64 Include="$(MSBuildThisFileDirectory)../../runtimes/win-x64/native/*" />
1210
</ItemGroup>
13-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Files found: @(_WebPNativeFiles_win_x64->'%(Filename)%(Extension)', ', ')" />
1411
<Copy SourceFiles="@(_WebPNativeFiles_win_x64)"
1512
DestinationFolder="$(OutputPath)"
1613
SkipUnchangedFiles="true" />
1714
</Target>
18-
<Target Name="DiagWebPNativeLibs_win_x64"
19-
AfterTargets="Build"
20-
Condition=" '$(RuntimeIdentifier)' != '' OR '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
21-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Target SKIPPED. TFI=$(TargetFrameworkIdentifier) RID=$(RuntimeIdentifier)" />
22-
</Target>
2315
</Project>

src/Imazen.WebP.NativeRuntime.win-x64/buildTransitive/net45/Imazen.WebP.NativeRuntime.win-x64.targets

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,12 @@
44
.NET Core/5+ handles runtimes/ natively via deps.json. -->
55
<Target Name="CopyWebPNativeLibs_win_x64"
66
AfterTargets="Build"
7-
Condition=" '$(RuntimeIdentifier)' == '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
8-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Target executing. TFI=$(TargetFrameworkIdentifier) RID=$(RuntimeIdentifier) OutputPath=$(OutputPath)" />
9-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Source dir: $(MSBuildThisFileDirectory)../../runtimes/win-x64/native/" />
7+
Condition=" '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
108
<ItemGroup>
119
<_WebPNativeFiles_win_x64 Include="$(MSBuildThisFileDirectory)../../runtimes/win-x64/native/*" />
1210
</ItemGroup>
13-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Files found: @(_WebPNativeFiles_win_x64->'%(Filename)%(Extension)', ', ')" />
1411
<Copy SourceFiles="@(_WebPNativeFiles_win_x64)"
1512
DestinationFolder="$(OutputPath)"
1613
SkipUnchangedFiles="true" />
1714
</Target>
18-
<Target Name="DiagWebPNativeLibs_win_x64"
19-
AfterTargets="Build"
20-
Condition=" '$(RuntimeIdentifier)' != '' OR '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
21-
<Message Importance="high" Text="[WebP.NativeRuntime.win-x64] Target SKIPPED (expected for .NET Core). TFI=$(TargetFrameworkIdentifier) RID=$(RuntimeIdentifier)" />
22-
</Target>
2315
</Project>

src/Imazen.WebP.NativeRuntime.win-x86/build/net45/Imazen.WebP.NativeRuntime.win-x86.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.NET Core/5+ handles runtimes/ natively via deps.json. -->
55
<Target Name="CopyWebPNativeLibs_win_x86"
66
AfterTargets="Build"
7-
Condition=" '$(RuntimeIdentifier)' == '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
7+
Condition=" '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
88
<ItemGroup>
99
<_WebPNativeFiles_win_x86 Include="$(MSBuildThisFileDirectory)../../runtimes/win-x86/native/*" />
1010
</ItemGroup>

src/Imazen.WebP.NativeRuntime.win-x86/buildTransitive/net45/Imazen.WebP.NativeRuntime.win-x86.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.NET Core/5+ handles runtimes/ natively via deps.json. -->
55
<Target Name="CopyWebPNativeLibs_win_x86"
66
AfterTargets="Build"
7-
Condition=" '$(RuntimeIdentifier)' == '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
7+
Condition=" '$(TargetFrameworkIdentifier)' != '.NETCoreApp' ">
88
<ItemGroup>
99
<_WebPNativeFiles_win_x86 Include="$(MSBuildThisFileDirectory)../../runtimes/win-x86/native/*" />
1010
</ItemGroup>

0 commit comments

Comments
 (0)