Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

NuGet dependency files copied in build output directory when targeting .NET Core+ but not copied for .NET Framework

$
0
0

I made a NuGet package, Askaiser.Marionette, that targets .NET Standard 2.0/2.1 and .NET 5.

Two of its dependencies are OpenCvSharp4 and OpenCvSharp4.runtime.win (native OpenCV bindings for Windows x64/x86).

Whenever I consume my package in a .NET Core app or .NET 5 app, any OpenCvSharp4 method works well because in the build output directory there is this runtimes directory that contains the native OpenCV library:

Debug/<netcoreapp3.1>/├──<...>└── runtimes/├── unix/<...>├── win/<...>├── win-x64/native/OpenCvSharpExtern.dll└── win-x86/native/OpenCvSharpExtern.dll

However, if my app targets .NET Framework (net461 up to net48), this runtimes directory is missing from the build output directory, resulting in the failure of any OpenCV wrapped method.This is fixed when the consumer app also installs the two OpenCvSharp4 packages.

Why do the consumer app needs to install the OpenCvSharp4 packages to work on .NET Framework? Right now, any person that tries to consume my package on .NET Framework would have to do that. This is not convenient.

If it can help, this is how my generated .nuspec looks like:

<?xml version="1.0" encoding="utf-8"?><package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"><metadata><id>Askaiser.Marionette</id>    [...]<dependencies><group targetFramework="net5.0"><dependency id="OpenCvSharp4" version="4.5.2.20210404" exclude="Build,Analyzers" /><dependency id="OpenCvSharp4.runtime.win" version="4.5.2.20210404" exclude="Build,Analyzers" /><dependency id="Tesseract" version="4.1.1" include="All" /><dependency id="Tesseract.Drawing" version="4.1.1" exclude="Build,Analyzers" /></group><group targetFramework=".NETStandard2.0"><dependency id="OpenCvSharp4" version="4.5.2.20210404" exclude="Build,Analyzers" /><dependency id="OpenCvSharp4.runtime.win" version="4.5.2.20210404" exclude="Build,Analyzers" /><dependency id="System.Text.Json" version="5.0.2" exclude="Build,Analyzers" /><dependency id="Tesseract" version="4.1.1" include="All" /><dependency id="Tesseract.Drawing" version="4.1.1" exclude="Build,Analyzers" /></group><group targetFramework=".NETStandard2.1"><dependency id="OpenCvSharp4" version="4.5.2.20210404" exclude="Build,Analyzers" /><dependency id="OpenCvSharp4.runtime.win" version="4.5.2.20210404" exclude="Build,Analyzers" /><dependency id="System.Text.Json" version="5.0.2" exclude="Build,Analyzers" /><dependency id="Tesseract" version="4.1.1" include="All" /><dependency id="Tesseract.Drawing" version="4.1.1" exclude="Build,Analyzers" /></group></dependencies>    [...]</metadata></package>

Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>