2

While it is possible to read a nupkg file with new ZipPackage("local/path//to/my/nupkgfile"). ZipPackage is a class in the NuGet.Core nuget package.

I would like to know if there is another class in this library that allows me to read the nuspec xml file.

What would be the best way to do this?

Andrew Gray
  • 3,593
  • 3
  • 35
  • 62

1 Answers1

3

There is the Manifest class which is used to read the .nuspec file.

The ZipPackage does not directly give you access to the Manifest. Information from the Manifest is available as properties on the ZipPackage class. So I would look at the information available on the ZipPackage if you are using that class. Otherwise you will have to locate the .nuspec file after extracting it from the .nupkg.

Matt Ward
  • 47,057
  • 5
  • 93
  • 94
  • Thanks Matt. Does that mean I can say var manifest = new Manifest("path\to\my\nuspecfile"); and that this Manifest class is part of the NuGet.Core library? – Andrew Gray Jul 12 '15 at 14:05
  • 1
    The Manifest class is part of the NuGet.Core library. You can create a Manifest using the static `Manifest.ReadFrom(Stream stream, bool validateSchema)` method. – Matt Ward Jul 12 '15 at 16:40
  • Thanks Matt. I actually managed to achieve what I wanted with a simple batch file and a nasty looking for loop – Andrew Gray Jul 17 '15 at 04:17