What is the right way to construct a NuGet package for a mixed-mode C++/CLI library?
I have 32-bit and 64-bit builds of the dll, and an ASP.NET Core app (targeting full .NET framework only) using it that will be built for both platforms. The app's solution platform is "AnyCPU".
I have tried using the /runtimes/
folders, but then Visual Studio can't find the managed code to compile against.
Currently I have 2 packages, like "MyLibrary" and "MyLibrary64", with the dll in the /lib/
folder and conditional PackageReference
in my csproj, but this doesn't feel right. Additionally, when I compile in VS, I get:
warning MSB3270: There was a mismatch between the processor architecture of the project
being built "MSIL" and the processor architecture of the reference "MyLibrary.dll", "x86".
This mismatch may cause runtime failures. Please consider changing the targeted processor
architecture of your project through the Configuration Manager so as to align the
processor architectures between your project and references, or take a dependency on
references with a processor architecture that matches the targeted processor architecture
of your project.
This questions is similar, but has no answers: Create NuGet package for C++/CLI (mixed) assembly
Update/Clarification:
the app can run either hosted in IIS (64-bit) or as a standalone self-hosted installed application (32-bit), so both are unfortunately necessary.