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 which needs to contain the DLL from the reference C++ project, and I can't figure out how to do this :/
In the C# project's CSPROJ file I have a reference to C++ project like this:
<ItemGroup>
<ProjectReference Include="..\Core\Com.BaseName.Core.csproj" PrivateAssets="All" />
<ProjectReference Include="..\Hashing\Com.BaseName.Hashing.vcxproj">
<Project>{028E03CD-5DAE-40FF-AAEF-4DF471D0076F}</Project>
<Name>Com.BaseName.Hashing</Name>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
</ProjectReference>
</ItemGroup>
(Sidenote: the first project reference above is another C# project within the same solution)
But when I generate the Nuget package it doesn't contain C++ project's DLL.
So then I tried adding the line marked with *** below in the the C# project's NUSPEC file:
<files>
.........
***<file src="Com.BaseName.Hashing.dll" target="lib\native" />
</files>
But then I get this error when trying to generate the nuget package:
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
Currently only the netcoreapp3.1 framework is mentioned in my NUSPEC file, as shown below:
<package>
<metadata>
......other metadata here.....
<dependencies>
<group targetFramework="netcoreapp3.1">
</group>
</dependencies>
</metadata>
<files>
<file src="Com.BaseName.Sdk.dll" target="lib\netcoreapp3.1" />
<file src="Com.BaseName.Core.dll" target="lib\netcoreapp3.1" />
<file src="Com.BaseName.Hashing.dll" target="lib\native" />
</files>
</package>
(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)
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 ?
(Also FYI, I've looked at a bunch of other related stackoverflow posts but none seem to address my question specifically.)