如何使用使用不同选项构建的 C# 和 C++ 库创建 Nuget 包?

How to create Nuget package with C# and C++ libraries built with different options?

有一个project that wraps V8 engine into C# library。它的 nuget 包坏了,我想修复它。创建包似乎很容易,并且有记录的方法可以为不同的 .NET 版本打包不同的 C# dll。但是,我不知道如何使用可以使用不同选项构建的 C++ 和 C# 代码打包 .dll:

我发现 this thread and it seems that one can use .targets file with MSBuild commands inside. Then i've read in the docs MSBuild 方法很旧,不推荐使用。那我该怎么办?

还有一个问题是:如果这个包依赖MSVC++,怎么指定呢?如何让 package consumer select 特定版本的 dll(针对 MSVC++2010、2012 或 2013 构建)?我想打包 msvcr*.dll.

不是个好主意

看看 SQLite 包如何部署它们的 DLL。使用 2.x 和更早版本的 NuGet,您需要编写一些 powershell 代码来检查 Visual Studio 的版本并手动将更改应用到项目。

我们正在努力通过将在 NuGet v3 中部署的更新来解决这个确切问题的更优雅的解决方案