2017-01-10 273 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

感謝您的迴應。由於你原來的問題的原因已經找到。請標記有用的答案,這對有相同問題的其他社區有益。 –