11# Get NuGet Package Metadata
22Ever wanted to get metadata from your NuGet packages, such as author or license information?
33Got lost looking for it in Visual Studio? Are you looking for a simple script that is able to
4- output all metadata information from a single command? This cmdlet is easy to use and
5- simple to integrate with your build / continuous integration process. If you don't have any
6- previous experience with scripting or PowerShell, follow the examples below.
4+ output all metadata information from a single command?
5+ Look no further!
6+
7+ This cmdlet is easy to use and simple to integrate with your build / continuous integration process.
8+
9+ If you don't have any previous experience with scripting or PowerShell, follow the examples below.
710
811## Installation
912
1013## Examples
1114### Simple usage
12- By default, the cmdlet recursively searches for .nupkg files relative to the folder you're in.
13- If you're using visual studio, open a PowerShell prompt on your project directory and run:
15+ By default, the cmdlet recursively searches for .nupkg files in the folder you're in.
16+ Open a PowerShell prompt in your project directory and run:
1417``` sh
1518$ Get-NuGetMetadata
1619```
1720It should output the metadata contents of every NuGet package within the project.
1821## Exporting output
22+ With powershell it's easy to save the data to file.
1923### To CSV
20- With powershell, saving information is as simple as piping the output of the GetNugetMetadata command
21- to a different command, which writes data to file.
2224``` sh
2325$ Get-NuGetMetadata | Export-Csv -NoTypeInformation ./my-metadata-file.csv
2426```
2527This produces a file named my-metadata-file.csv in the directory you are in.
2628### To JSON
2729Since the Get-NugetMetadata cmdlet produces xml, it can't be easily converted to Json using ConvertTo-Json.
28- One workaround is to construct a custom PSObject by filtering properties of the metadata as such :
30+ One workaround is to pipe via select, which then creates a PSObject that can be converted :
2931``` sh
3032$ Get-NuGetMetadata | Select-Object id, version, licenseUrl | ConvertTo-Json | Out-File ./my-metadata-file.csv
3133```
3234
3335
34- ### Converting output to JSON
35-
36-
37-
38-
3936## Release History
4037
4138* 1.0.0
@@ -44,5 +41,3 @@ $ Get-NuGetMetadata | Select-Object id, version, licenseUrl | ConvertTo-Json | O
4441## License
4542
4643Distributed under the MIT license. See `` LICENSE `` for more information.
47-
48-
0 commit comments