2017-01-10 276 views
0

我目前正在尝试为zLib(http://www.zlib.net/)创建一个NuGet包。 我使用“grpc zlib”NuGet包(https://www.nuget.org/packages/grpc.dependencies.zlib/)来复制文件夹结构,然后添加zLib .dll,.lib和头文件。NuGet安装包错误

这是我自己制作的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的包工作精细。

感谢您的帮助提前!

回答

1

您需要添加.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中的“Adding .targets”部分。

.targets的详细信息,请关注文档中的.targets内容:Deep Dive into NuGet Native,并注意.targets必须命名为与.targets和/或.props扩展名相同的软件包ID。

+0

谢谢你的回应:) –

+0

也许你可以看看我的另一个问题。 (http://stackoverflow.com/q/41591797/6172447) –

0

那么,我的NuGet包明显是缺少.targets文件。 我使用thisthis(感谢@ Wendy - MSFT)获得帮助。我还查看了一些现有zlib软件包的.target文件,以了解该文件的外观。

+0

感谢您的回应。由于你原来的问题的原因已经找到。请标记有用的答案,这对有相同问题的其他社区有益。 –