Skip to content

Fix: correct FFmpeg DLL path in runtime.win package and detect dotnet pack failures - #1883

Merged
shimat merged 5 commits into
mainfrom
claude/hungry-robinson-1457ce
May 28, 2026
Merged

shimat merged 5 commits into
mainfrom
claude/hungry-robinson-1457ce

Conversation

@shimat

@shimat shimat commented May 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • nuget/OpenCvSharp4.runtime.win.csproj: Fix the path to opencv_videoio_ffmpeg4130_64.dll. The Visual Studio generator installs it to opencv_artifacts/x64/vc17/bin/, not opencv_artifacts/bin/, causing dotnet pack to fail with "Could not find a part of the path".
  • .github/workflows/windows.yml: Switch Pack NuGet packages step from shell: powershell (Windows PowerShell 5.1) to shell: pwsh (PowerShell 7) and add $PSNativeCommandUseErrorActionPreference = $true. This makes native command failures (e.g. dotnet pack) respect $ErrorActionPreference = "Stop", so errors are no longer silently ignored.

Root cause

dotnet pack nuget/OpenCvSharp4.runtime.win.csproj was failing with:

error : Could not find a part of the path 'D:\a\opencvsharp\opencvsharp\opencv_artifacts\bin'

Because the Pack NuGet packages step did not detect native command failures, execution continued silently. This caused a cascade: OpenCvSharp4.Windows also failed to pack (it depends on OpenCvSharp4.runtime.win being present in the local artifact source). Both packages were missing from the NuGet publish run.
The correct DLL path was confirmed by inspecting the opencv_artifacts directory structure in CI:
opencv_artifacts/x64/vc17/bin/opencv_videoio_ffmpeg4130_64.dll

Test plan

  • windows.yml CI completes successfully and both OpenCvSharp4.runtime.win.*.nupkg and OpenCvSharp4.Windows.*.nupkg are produced
  • If a dotnet pack step fails in the future, the workflow step fails immediately

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced NuGet package validation in the CI/CD pipeline with improved error detection for missing packages
    • Updated Windows native library source path in the runtime package for better consistency

Review Change Stack

shimat and others added 3 commits May 28, 2026 22:33
…otnet pack failures

FFmpeg is now statically linked into OpenCvSharpExtern.dll via vcpkg (x64-windows-static),
so opencv_videoio_ffmpeg4130_64.dll is no longer installed and should not be packaged.
Also add $LASTEXITCODE checks after each dotnet command so pack failures are no longer
silently swallowed by PowerShell's $ErrorActionPreference = "Stop".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… step

Replace the repeated $LASTEXITCODE checks with $PSNativeCommandUseErrorActionPreference = $true
(PowerShell 7.3+), which makes all native commands respect $ErrorActionPreference = "Stop".
Also switch shell from powershell (Windows PowerShell 5.1) to pwsh (PowerShell 7) required
for this feature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shimat shimat self-assigned this May 28, 2026
…s step

The DLL is installed to opencv_artifacts/x64/vc17/bin/ (Visual Studio generator layout),
not the previously referenced opencv_artifacts/bin/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shimat shimat changed the title Fix: remove obsolete FFmpeg DLL from runtime.win package and detect dotnet pack failures Fix: correct FFmpeg DLL path in runtime.win package and detect dotnet pack failures May 28, 2026
…im variants

The previous check only validated OpenCvSharp4.runtime.win.slim and OpenCvSharp4.Windows.Slim,
so missing non-slim packages (runtime.win, Windows) went undetected and publish proceeded
with incomplete artifacts. Now all 12 expected packages are checked explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shimat
shimat marked this pull request as ready for review May 28, 2026 14:29
@shimat
shimat merged commit 9a49884 into main May 28, 2026
9 of 10 checks passed
@shimat
shimat deleted the claude/hungry-robinson-1457ce branch May 28, 2026 14:29
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0c4cd1c7-6528-470a-802b-cd0527ccb434

📥 Commits

Reviewing files that changed from the base of the PR and between 9ede960 and 1819a39.

📒 Files selected for processing (3)
  • .github/workflows/publish_nuget.yml
  • .github/workflows/windows.yml
  • nuget/OpenCvSharp4.runtime.win.csproj

📝 Walkthrough

Walkthrough

This PR enhances the OpenCvSharp NuGet packaging pipeline by updating native DLL artifact sources, fixing PowerShell error handling during package creation, and generalizing package validation across multiple target platforms and architectures before publication.

Changes

NuGet Packaging and Publication Pipeline

Layer / File(s) Summary
Native DLL artifact source path
nuget/OpenCvSharp4.runtime.win.csproj
Windows runtime package updated to reference opencv_videoio_ffmpeg4130_64.dll from the VC17-specific artifact path ../opencv_artifacts/x64/vc17/bin/ instead of the generic ../opencv_artifacts/bin/.
Windows packaging shell environment
.github/workflows/windows.yml
"Pack NuGet packages" step switches from powershell to pwsh and enables $PSNativeCommandUseErrorActionPreference = $true to ensure native command failures trigger the stop-on-error behavior.
Multi-platform package validation
.github/workflows/publish_nuget.yml
Package validation replaces Windows-slim-specific checks with a check_package helper function that validates multiple glob patterns for Windows, Linux (arm/arm64), wasm, and x64 variants, accumulates failures, and logs all detected .nupkg files when validation fails.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • shimat/opencvsharp#1825: Both PRs modify .github/workflows/publish_nuget.yml to change package verification logic around which .nupkg artifacts are validated before publishing.
  • shimat/opencvsharp#1845: Both PRs modify .github/workflows/publish_nuget.yml in the artifact-handling and package validation flow during the publish job.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/hungry-robinson-1457ce

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shimat shimat added the bug Confirmed defect in OpenCvSharp label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed defect in OpenCvSharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant