什么是为混合模式C++/CLI库构建NuGet包的正确方法?
我有32位和64位版本的dll,以及一个使用它的ASP.NET Core应用程序(仅针对完整的.NET框架),将为两个平台构建。该应用程序的解决方案平台为“AnyCPU”。
我尝试使用“/runtimes/”文件夹,但Visual Studio无法找到要编译的托管代码。
目前,我有2个包,如“MyLibrary”和“MyLibrary64”,其中dll在“/lib/”文件夹中,并且在我的csproj中有条件的“PackageReference”,但这感觉不对。此外,当我在VS中编译时,会得到:
我有32位和64位版本的dll,以及一个使用它的ASP.NET Core应用程序(仅针对完整的.NET框架),将为两个平台构建。该应用程序的解决方案平台为“AnyCPU”。
我尝试使用“/runtimes/”文件夹,但Visual Studio无法找到要编译的托管代码。
目前,我有2个包,如“MyLibrary”和“MyLibrary64”,其中dll在“/lib/”文件夹中,并且在我的csproj中有条件的“PackageReference”,但这感觉不对。此外,当我在VS中编译时,会得到:
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.
这个问题类似,但没有答案: 创建用于C++/CLI(混合)程序集的NuGet包
更新/澄清:
该应用程序可以在IIS中托管(64位),也可以作为独立安装的应用程序(32位)运行,因此两者都是必需的。