title: How to correctly reference and include a C++ DLL in a C# project's Nuget package?
body: <p>I have a Visual Studio solution which contains a C++ project, which I need to reference in another C# .NET Core project contained within the same solution. The C# project here is supposed to output a Nuget package <strong>which needs to contain the DLL from the reference C++ project, and I can't figure out how to do this</strong> :/</p>
  <p>In the C# project's CSPROJ file I have a reference to C++ project like this:</p>
  <pre><code>  &lt;ItemGroup&gt;
      &lt;ProjectReference Include=&quot;..\Core\Com.BaseName.Core.csproj&quot; PrivateAssets=&quot;All&quot; /&gt;
      &lt;ProjectReference Include=&quot;..\Hashing\Com.BaseName.Hashing.vcxproj&quot;&gt;
        &lt;Project&gt;{028E03CD-5DAE-40FF-AAEF-4DF471D0076F}&lt;/Project&gt;
        &lt;Name&gt;Com.BaseName.Hashing&lt;/Name&gt;
        &lt;ReferenceOutputAssembly&gt;true&lt;/ReferenceOutputAssembly&gt;
        &lt;OutputItemType&gt;Content&lt;/OutputItemType&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
        &lt;Private&gt;true&lt;/Private&gt;
        &lt;CopyLocalSatelliteAssemblies&gt;true&lt;/CopyLocalSatelliteAssemblies&gt;
      &lt;/ProjectReference&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  <p>(Sidenote: the first project reference above is another C# project within the same solution)</p>
  <p>But when I generate the Nuget package it doesn't contain C++ project's DLL.</p>
  <p>So then I tried adding the line marked with *** below in the the C# project's NUSPEC file:</p>
  <pre><code>&lt;files&gt;
    .........
    ***&lt;file src=&quot;Com.BaseName.Hashing.dll&quot; target=&quot;lib\native&quot; /&gt;
  &lt;/files&gt;
  </code></pre>
  <p>But then I get this error when trying to generate the nuget package:</p>
  <pre><code>Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
  - Add a dependency group for native0.0 to the nuspec
  </code></pre>
  <p>Currently only the <code>netcoreapp3.1</code> framework is mentioned in my NUSPEC file, as shown below:</p>
  <pre><code>&lt;package&gt;
    &lt;metadata&gt;
      ......other metadata here.....
      &lt;dependencies&gt;
        &lt;group targetFramework=&quot;netcoreapp3.1&quot;&gt;
        &lt;/group&gt;
      &lt;/dependencies&gt;
    &lt;/metadata&gt;
    &lt;files&gt;
      &lt;file src=&quot;Com.BaseName.Sdk.dll&quot; target=&quot;lib\netcoreapp3.1&quot; /&gt;
      &lt;file src=&quot;Com.BaseName.Core.dll&quot; target=&quot;lib\netcoreapp3.1&quot; /&gt;
      &lt;file src=&quot;Com.BaseName.Hashing.dll&quot; target=&quot;lib\native&quot; /&gt;
    &lt;/files&gt;
  &lt;/package&gt;
  </code></pre>
  <p>(side note: the first DLL mentioned under the 'files' property above is of the C# project itself, and the second DLL is of another C# project that's referenced)</p>
  <p><strong>Can someone please tell me how to correct specify that the unmanaged DLL of the referenced C++ project needs to be present in the Nuget package too ?</strong></p>
  <p>(Also FYI, I've looked at a bunch of other related stackoverflow posts but none seem to address my question specifically.)</p>