I have a nuget package that I've built and uploaded to our Nuget repository. In it are 2 native dlls. One for 32-bit and one for 64-bit. I'll be referencing them in various projects (net472, net6, and .netstandard2.0). When I add them via the package manager, it simply downloads them to the Nuget cache and that's it. I suppose that makes sense because they are native libraries and not .NET libraries so nothing would depended on them directly. They are found and loaded explicitly at runtime however. I would like both of these Dlls to be placed in the output folder of the referencing project in a folder named DllHome/
. It is very difficult to google for this answer because the search terms are so common, and I get results for everything BUT what I'm looking for. The .nuspec file for my package is below.
<?xml version="1.0" encoding="utf-8"?><package ><metadata><id>MyDLLs</id><title>MyDLLs</title><version>1.0.0.0</version><authors>author</authors><tags>MyDLLs</tags><description>My DLLs</description><repository type="git" url="https://github.com/myrepo/nuget"/><dependencies></dependencies></metadata><files><file src="Release/MyDLL32.dll" target="runtimes/win-x86/native"/><file src="Release/MyDLL64.dll" target="runtimes/win-x64/native"/> </files></package>
I've seen something similar to what I want with a SQLite package. The .NET package brought in some native dlls and automatically deployed them to my output folder in x86/
and x64/
folders respectively when I built.