1
1
# Get NuGet Package Metadata
2
2
Ever wanted to get metadata from your NuGet packages, such as author or license information?
3
3
Got 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.
7
10
8
11
## Installation
9
12
10
13
## Examples
11
14
### 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:
14
17
``` sh
15
18
$ Get-NuGetMetadata
16
19
```
17
20
It should output the metadata contents of every NuGet package within the project.
18
21
## Exporting output
22
+ With powershell it's easy to save the data to file.
19
23
### 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.
22
24
``` sh
23
25
$ Get-NuGetMetadata | Export-Csv -NoTypeInformation ./my-metadata-file.csv
24
26
```
25
27
This produces a file named my-metadata-file.csv in the directory you are in.
26
28
### To JSON
27
29
Since 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 :
29
31
``` sh
30
32
$ Get-NuGetMetadata | Select-Object id, version, licenseUrl | ConvertTo-Json | Out-File ./my-metadata-file.csv
31
33
```
32
34
33
35
34
- ### Converting output to JSON
35
-
36
-
37
-
38
-
39
36
## Release History
40
37
41
38
* 1.0.0
@@ -44,5 +41,3 @@ $ Get-NuGetMetadata | Select-Object id, version, licenseUrl | ConvertTo-Json | O
44
41
## License
45
42
46
43
Distributed under the MIT license. See `` LICENSE `` for more information.
47
-
48
-
0 commit comments