visual-studio-2015 - NuGet安装包错误

标签 visual-studio-2015 nuget nuget-package zlib

我目前正在尝试为 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/

相关文章:

git - 在 Visual Studio Online 中使用自定义 NuGet 源

c# - 如何在没有互联网的情况下在树莓派上包含 nuget 包?

asp.net-web-api - 在 .NET Framework 4.7.1 项目中安装 Microsoft.Extensions.DependencyInjection

nuget-package - Nuget 管理器在连接到人工制品时不提示凭据

.net - 如何在特定文件夹上创建新包?

c++ - 如何添加那些自己包装 block 的代码包装器?

visual-studio-2015 - Visual Studio 2015 Update 1在启动时卡住

c++ - Visual Studio 2013 专业版错误 MSB8020

visual-studio-2015 - azure logic app,visual studio,从门户打开现有的逻辑应用程序?

c# - 如何将其他文件添加到 Visual Studio 2017 中的 NuGet 包?