我目前正在尝试为 zLib 创建 NuGet 包 ( http://www.zlib.net/ )。 我使用“grpc zlib”NuGet 包 ( https://www.nuget.org/packages/grpc.dependencies.zlib/ ) 复制文件夹结构,然后添加 zLib .dll、.lib 和头文件。
这是我自制的 zlib NuGet 包:https://drive.google.com/file/d/0B_2A8x02vzDwOWVGUmxkeGdBNm8/view?usp=sharing
但是,当我尝试在 VS 中安装我的包时,我收到以下错误:
Severity Code Description Project File Line Suppression State Error Could not install package 'zlib 1.2.8'. You are trying to install this package into a project that targets 'native,Version=v0.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0
使用 grpc zlib 包工作正常。
提前感谢您的帮助!
最佳答案
您需要添加 .targets 以识别包中的程序集和 winmd 文件。
根据错误和您的包,您的\build 文件夹中缺少 .targets/或 .props。
C++ and JavaScript projects that might consume your NuGet package need a .targets file to identify the necessary assembly and winmd files.
请引用this link中的“添加.targets”部分.
.targets的详细信息,请关注文档中的.targets内容:Deep Dive into NuGet Native ,并注意 .targets 的命名必须与带有 .targets 和/或 .props 扩展名的包 ID 相同。
关于visual-studio-2015 - NuGet安装包错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41567009/