简体   繁体   English

使用NuGet.Core以编程方式读取NuSpec文件

[英]Programmatically read NuSpec file with NuGet.Core

While it is possible to read a nupkg file with new ZipPackage("local/path//to/my/nupkgfile"). 虽然可以使用新的ZipPackage(“ local / path // to / my / nupkgfile”)读取nupkg文件。 ZipPackage is a class in the NuGet.Core nuget package. ZipPackage是NuGet.Core nuget包中的类。

I would like to know if there is another class in this library that allows me to read the nuspec xml file. 我想知道这个库中是否有另一个类可以让我读取nuspec xml文件。

What would be the best way to do this? 最好的方法是什么?

There is the Manifest class which is used to read the .nuspec file. 有清单类,用于读取.nuspec文件。

The ZipPackage does not directly give you access to the Manifest. ZipPackage不能直接授予您访问清单的权限。 Information from the Manifest is available as properties on the ZipPackage class. 来自清单的信息可作为ZipPackage类的属性获得。 So I would look at the information available on the ZipPackage if you are using that class. 因此,如果您使用的是此类,我将查看ZipPackage上的可用信息。 Otherwise you will have to locate the .nuspec file after extracting it from the .nupkg. 否则,您需要从.nupkg中提取.nuspec文件,然后找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM