From 763ef8de9292c3702c11a218744f858f47bedb04 Mon Sep 17 00:00:00 2001 From: shimat Date: Wed, 25 Feb 2026 16:20:06 +0900 Subject: [PATCH 1/4] restore linux RID package --- .github/workflows/ubuntu-slim.yml | 12 +++++++++ .github/workflows/ubuntu.yml | 14 ++++++++++ README.md | 20 +++++++------- embedded-builds.md => docs/embedded-builds.md | 0 ...CvSharp4.official.runtime.linux-x64.csproj | 27 +++++++++++++++++++ ...rp4.official.runtime.linux-x64.slim.csproj | 26 ++++++++++++++++++ 6 files changed, 90 insertions(+), 9 deletions(-) rename embedded-builds.md => docs/embedded-builds.md (100%) create mode 100644 nuget/OpenCvSharp4.official.runtime.linux-x64.csproj create mode 100644 nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj diff --git a/.github/workflows/ubuntu-slim.yml b/.github/workflows/ubuntu-slim.yml index 840ece6a50..6388695514 100644 --- a/.github/workflows/ubuntu-slim.yml +++ b/.github/workflows/ubuntu-slim.yml @@ -183,6 +183,18 @@ jobs: package_project="OpenCvSharp4.official.runtime.ubuntu.${{ matrix.ubuntu }}-x64.slim.csproj" dotnet pack "nuget/${package_project}" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version + - name: Create linux-x64 NuGet package (slim) + if: matrix.ubuntu == '22.04' + env: + BETA: "-beta" + run: | + yyyymmdd=`date '+%Y%m%d'` + version="${OPENCV_VERSION}.${yyyymmdd}${BETA}" + echo "Package version: $version" + + cd ${GITHUB_WORKSPACE}/opencvsharp + dotnet pack "nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version + - uses: actions/upload-artifact@v6 with: name: artifacts_ubuntu_slim_${{ matrix.ubuntu }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 35e86c8229..f367faaf73 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -184,6 +184,20 @@ jobs: ls ${GITHUB_WORKSPACE}/artifacts + - name: Create linux-x64 NuGet package + if: matrix.ubuntu == '22.04' + env: + BETA: "-beta" + run: | + yyyymmdd=`date '+%Y%m%d'` + version="${OPENCV_VERSION}.${yyyymmdd}${BETA}" + echo "Package version: $version" + + cd ${GITHUB_WORKSPACE}/opencvsharp + dotnet pack "nuget/OpenCvSharp4.official.runtime.linux-x64.csproj" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version + + ls ${GITHUB_WORKSPACE}/artifacts + - uses: actions/upload-artifact@v6 with: name: artifacts_ubuntu_${{ matrix.ubuntu }} diff --git a/README.md b/README.md index 1c5a3c54f4..fe5210aaae 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ dotnet add package OpenCvSharp4.Windows ### Linux / Ubuntu ```bash dotnet add package OpenCvSharp4 -dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64 +dotnet add package OpenCvSharp4.official.runtime.linux-x64 # optional slim profile (smaller native dependency surface) -# dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim +# dotnet add package OpenCvSharp4.official.runtime.linux-x64.slim ``` For more installation options, see the [Installation](#installation) section below. @@ -54,21 +54,20 @@ For a smaller feature profile, pair `OpenCvSharp4` with `OpenCvSharp4.runtime.wi ### UWP Add `OpenCvSharp4` and `OpenCvSharp4.runtime.uwp` NuGet packages to your project. Note that `OpenCvSharp4.runtime.win` and `OpenCvSharp4.Windows` don't work for UWP. -### Ubuntu 24.04 -Add `OpenCvSharp4` and `OpenCvSharp4.official.runtime.ubuntu.24.04-x64` NuGet packages to your project. +### Linux (Ubuntu and other distributions) +Add `OpenCvSharp4` and `OpenCvSharp4.official.runtime.linux-x64` NuGet packages to your project. This package uses the portable `linux-x64` RID and works with .NET 8+ publish/deploy workflows out of the box. ```bash dotnet new console -n ConsoleApp01 cd ConsoleApp01 dotnet add package OpenCvSharp4 -dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64 +dotnet add package OpenCvSharp4.official.runtime.linux-x64 # or slim profile: -# dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim +# dotnet add package OpenCvSharp4.official.runtime.linux-x64.slim # -- edit Program.cs --- # dotnet run ``` -### Other Linux distributions -Add `OpenCvSharp4` and the appropriate Ubuntu runtime package (for example `OpenCvSharp4.official.runtime.ubuntu.24.04-x64`) to your project. The Ubuntu runtime packages are built on the specified Ubuntu releases and may work on similar distributions. +Distro-specific packages (`OpenCvSharp4.official.runtime.ubuntu.24.04-x64`, `OpenCvSharp4.official.runtime.ubuntu.22.04-x64`) are also available but use distro-specific RIDs that are [no longer resolved automatically by .NET 8+](https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/rid-graph). The `linux-x64` package is recommended for most users. ### Slim profile module coverage @@ -82,6 +81,7 @@ This profile is used by: - `OpenCvSharp4.runtime.win.slim` - `OpenCvSharp4.Windows.Slim` +- `OpenCvSharp4.official.runtime.linux-x64.slim` - `OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim` - `OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim` @@ -167,6 +167,8 @@ http://shimat.github.io/opencvsharp/api/OpenCvSharp.html |**[OpenCvSharp4.runtime.win](https://www.nuget.org/packages/OpenCvSharp4.runtime.win/)**| Native bindings for Windows x64/x86 (except UWP) | |**[OpenCvSharp4.runtime.win.slim](https://www.nuget.org/packages/OpenCvSharp4.runtime.win.slim/)**| Slim native bindings for Windows x64/x86 (except UWP), with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled | |**[OpenCvSharp4.runtime.uwp](https://www.nuget.org/packages/OpenCvSharp4.runtime.uwp/)**| Native bindings for UWP (Universal Windows Platform) x64/x86/ARM | +|**[OpenCvSharp4.official.runtime.linux-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.linux-x64/)**| Native bindings for Linux x64 (portable RID, recommended) | +|**[OpenCvSharp4.official.runtime.linux-x64.slim](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.linux-x64.slim/)**| Slim native bindings for Linux x64 (portable RID), with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled | |**[OpenCvSharp4.official.runtime.ubuntu.22.04-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.22.04-x64/)**| Native bindings for Ubuntu 22.04 x64 | |**[OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim/)**| Slim native bindings for Ubuntu 22.04 x64, with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled | |**[OpenCvSharp4.official.runtime.ubuntu.24.04-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.24.04-x64/)**| Native bindings for Ubuntu 24.04 x64 | @@ -238,7 +240,7 @@ dotnet run ``` ## Customizing OpenCV and OpenCvSharp for embedded (ARM) Platforms -If you want to use OpenCV and OpenCvSharp on an embedded platform like a Raspberry Pi with a 64-bit OS, you have to build both libraries manually, and it's easiest to build it right on your target hardware to avoid cross-compiler toolchain challenges. [The instructions for this build and install are here](embedded-builds.md). +If you want to use OpenCV and OpenCvSharp on an embedded platform like a Raspberry Pi with a 64-bit OS, you have to build both libraries manually, and it's easiest to build it right on your target hardware to avoid cross-compiler toolchain challenges. [The instructions for this build and install are here](docs/embedded-builds.md). ## Donations If you find the OpenCvSharp library useful and would like to show your gratitude by donating, here are some donation options. Thank you. diff --git a/embedded-builds.md b/docs/embedded-builds.md similarity index 100% rename from embedded-builds.md rename to docs/embedded-builds.md diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj new file mode 100644 index 0000000000..b43aaeebf5 --- /dev/null +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj @@ -0,0 +1,27 @@ + + + netstandard2.0;netstandard2.1;net8.0; + true + false + + + OpenCvSharp4.official.runtime.linux-x64 + OpenCvSharp native bindings for Linux x64 + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + opencvsharp.png + Internal implementation package for OpenCvSharp to work on Linux x64 (portable RID) + Image Processing OpenCV Wrapper FFI opencvsharp linux + Copyright 2008-2026 + + https://github.com/shimat/opencvsharp.git + git + false + + + + + + + diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj new file mode 100644 index 0000000000..83b355b88f --- /dev/null +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj @@ -0,0 +1,26 @@ + + + netstandard2.0;netstandard2.1;net8.0; + true + false + + OpenCvSharp4.official.runtime.linux-x64.slim + OpenCvSharp native bindings for Linux x64 (Slim) + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + opencvsharp.png + Slim native bindings package for OpenCvSharp on Linux x64 (portable RID). Enabled modules: core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo. Disabled modules: contrib,dnn,ml,video,videoio,highgui,stitching,barcode. + Image Processing OpenCV Wrapper FFI opencvsharp linux slim + Copyright 2008-2026 + + https://github.com/shimat/opencvsharp.git + git + false + + + + + + + From 145d972487db5a1c114faa3721364b19c0be09b9 Mon Sep 17 00:00:00 2001 From: shimat Date: Wed, 25 Feb 2026 16:40:05 +0900 Subject: [PATCH 2/4] Fix icon path in OpenCvSharp4 project file --- nuget/OpenCvSharp4.official.runtime.linux-x64.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj index b43aaeebf5..d1316031d3 100644 --- a/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj @@ -22,6 +22,6 @@ - + From 2bfddaf07912246c429cb865095e09594d0977d0 Mon Sep 17 00:00:00 2001 From: shimat Date: Wed, 25 Feb 2026 16:40:39 +0900 Subject: [PATCH 3/4] Fix icon path for opencvsharp.png in project file --- nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj index 83b355b88f..b17f859c64 100644 --- a/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj @@ -21,6 +21,6 @@ - + From 88e6ba3e3dc2653c31bb1205e2ed4aeaa78a2950 Mon Sep 17 00:00:00 2001 From: shimat Date: Wed, 25 Feb 2026 18:31:19 +0900 Subject: [PATCH 4/4] fix --- nuget/OpenCvSharp4.official.runtime.linux-x64.csproj | 4 ++-- nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj | 4 ++-- nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj | 4 ++-- ...OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj | 4 ++-- nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj | 4 ++-- ...OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj | 4 ++-- nuget/OpenCvSharp4.runtime.linux-arm.csproj | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj index d1316031d3..2c33002276 100644 --- a/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -21,7 +21,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj index b17f859c64..f19da17ee2 100644 --- a/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -20,7 +20,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj index 86dd78d26c..8f9a22a84f 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -21,7 +21,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj index ebafae3aae..afca64f78a 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -20,7 +20,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj index 4e99d88bac..31b849ee83 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -21,7 +21,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj index a51f46230a..dffa3a171c 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -20,7 +20,7 @@ - + diff --git a/nuget/OpenCvSharp4.runtime.linux-arm.csproj b/nuget/OpenCvSharp4.runtime.linux-arm.csproj index 5a2f64921c..4aa93ae8e7 100644 --- a/nuget/OpenCvSharp4.runtime.linux-arm.csproj +++ b/nuget/OpenCvSharp4.runtime.linux-arm.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;netcoreapp3.1; + netstandard2.0;netstandard2.1;netcoreapp3.1 true false @@ -21,7 +21,7 @@ - +