I have a C++/CLI DLL that interfaces a third party native DLL. I want to pack this as Nuget.
I followed this official MS guide, this blog post and read through this other question.
So here is what I did:
First, I created the proper nuspec file:
<?xml version="1.0"?>
<package >
<metadata>
<id>CPlusPlusNativeIFace</id>
<version>1.0.4</version>
<title>CPlusPlusNativeIFace</title>
<authors>Jens Rabe</authors>
<owners>Who owns that</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A DLL that makes a native third-party DLL available to .net</description>
<releaseNotes>foo</releaseNotes>
<copyright>errm...</copyright>
<tags>foo bar</tags>
</metadata>
<files>
<file src="..\Release\**" target="runtimes/win-x86/lib/net461" />
<file src="..\x64\Release\**" target="runtimes/win-x64/lib/net461" />
<file src="DummyAny\**" target="ref\net461" />
</files>
</package>
Then I compiled the DLL for Release x86 and Release X64. Then I created the DummyAny
folder, copied the contents of the x86 one in, and used the corflags
utility like in Links 2 and 3 to strip the 32 bit flag.
When I now nuget pack
and nuget add
, and try to reference that package in another project, I always get:
Could not install package 'CPlusPlusNativeIFace 1.0.4'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I double checked that the files are right:
- I have the x86 stuff in
runtimes/win-x86/lib/net461
- I have the x64 stuff in
runtimes/win-x64/lib/net461
- I have a
ref/net461
folder with the manipulated dll in
But I still can't load the package.
I also tried putting the CPU specific DLLs into runtimes/win-x86/native
and runtimes/win-x64/native
to no avail.
What else am I missing? Does that not work for C++/CLI projects built against .net Framework?