1
1
# assemblies loaded in the manifest:
2
2
Add-Type - AssemblyName " System.IO.Compression"
3
- Add-Type - AssemblyName " System.IO.Compression.FileSystem"
4
3
5
-
6
- # ::string -> XmlDocument
7
4
function Get-NuGetMetadata {
8
5
[CmdletBinding (
9
6
DefaultParameterSetName = ' Path'
@@ -13,16 +10,11 @@ function Get-NuGetMetadata {
13
10
[string ]$Path ,
14
11
15
12
[Parameter (ParameterSetName = ' ConfigPath' )]
16
- [string ]$ConfigPath ,
17
-
18
- [Parameter (ParameterSetName = ' Path' )]
19
- [switch ]$NoRecurse
13
+ [string ]$ConfigPath
20
14
)
21
-
22
15
BEGIN {
23
16
$GCIparam = @ {
24
17
Path = $Path
25
- Recurse = ! $NoRecurse
26
18
}
27
19
28
20
$sln = Get-ChildItem - Filter ' *.sln' @GCIparam
@@ -78,7 +70,7 @@ function Get-NupkgMetadata {
78
70
Get-ZipFileEntry |
79
71
SelectMatchingFullName - Pattern $EntryPattern |
80
72
Get-ZipFileEntryContent |
81
- GetXmlMetadata
73
+ GetNuGetPackageMetadata
82
74
}
83
75
else {
84
76
Write-Error - Message " Path '$p ' not found"
@@ -146,7 +138,7 @@ function GetPackageNameVersion {
146
138
if (Test-Path $Path ) {
147
139
$xml = [xml ](Get-Content $Path )
148
140
Select-Xml - Xml $xml - XPath ' //PackageReference' |
149
- Select-Object - ExpandProperty Node |
141
+ select - ExpandProperty Node |
150
142
ForEach-Object {
151
143
$output = [PSCustomObject ]@ {
152
144
Name = $_.Include
@@ -175,17 +167,9 @@ function GetNuGetPackageDirectory {
175
167
Param (
176
168
[Parameter (
177
169
Mandatory = $true ,
178
- ValueFromPipelineByPropertyName = $true
179
- )]
180
- [ValidateNotNullOrEmpty ()]
181
- [string ]$Name ,
182
-
183
- [Parameter (
184
- Mandatory = $true ,
185
- ValueFromPipelineByPropertyName = $true
170
+ ValueFromPipeline = $true
186
171
)]
187
- [ValidateNotNullOrEmpty ()]
188
- [string ]$Version
172
+ [PSCustomObject ]$NameVersion
189
173
)
190
174
BEGIN {
191
175
# todo: add logic here, for NuGet.config n stuff
@@ -194,7 +178,7 @@ function GetNuGetPackageDirectory {
194
178
PROCESS {
195
179
Write-Verbose " GetNuGetPackageDirectory input: $Path "
196
180
$output = [PSCustomObject ]@ {
197
- Path = " $NuGetDefaultFolder \$Name \ $ Version"
181
+ Path = " $NuGetDefaultFolder \$ ( $NameVersion . Name) \ $ ( $NameVersion . Version) "
198
182
}
199
183
Write-Verbose " GetNuGetPackageDirectory output: $output "
200
184
$output
@@ -258,7 +242,7 @@ function Get-ZipFileEntryContent {
258
242
$deflateStream = $file.Open ()
259
243
$streamReader = New-Object System.IO.StreamReader($deflateStream )
260
244
$fileContent = $streamReader.ReadToEnd ()
261
- Write-Output $fileContent
245
+ $fileContent
262
246
}
263
247
catch {
264
248
WriteExceptionAsError $_
@@ -272,8 +256,8 @@ function Get-ZipFileEntryContent {
272
256
END {}
273
257
}
274
258
275
- # ::string[] -> XmlDocument
276
- function GetXmlMetadata {
259
+ # ::XmlDocument -> XmlDocument
260
+ function GetNuGetPackageMetadata {
277
261
Param (
278
262
[Parameter (
279
263
Mandatory = $true ,
0 commit comments