2
votes

i am currently trying to create a NuGet package for zLib (http://www.zlib.net/). I used the "grpc zlib" NuGet package (https://www.nuget.org/packages/grpc.dependencies.zlib/) to copy the folder structure and then added the zLib .dll, .lib and header files.

This is my self crafted zlib NuGet-package: https://drive.google.com/file/d/0B_2A8x02vzDwOWVGUmxkeGdBNm8/view?usp=sharing

However when i try to install my package in VS, then i get following error:

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

Using the grpc zlib package is working fine.

Thanks for your help in advance!

2

2 Answers

2
votes

You need add the .targets in to identify the assembly and winmd files in your package.

According to the error and your package, the .targets /or .props was missing in your \build folder.

C++ and JavaScript projects that might consume your NuGet package need a .targets file to identify the necessary assembly and winmd files.

Please refer to the “Adding .targets” part in this link.

Detailed information for .targets, please focus on .targets content in the document: Deep Dive into NuGet Native, and pay attention that .targets must be named the same as the package ID with the .targets and/or .props extensions.

0
votes

Well the point with my NuGet-package obviously was that there was the .targets file missing. I added the file using this and this (thanks to @Wendy - MSFT) for help. I also looked at .target files of some existing zlib-packages to figure out, how the file has to look like.