@@ -189,13 +189,16 @@ string ResolveVersionForPackage(string id) {
189189 // is it choco spec?
190190 specs = jsonConfig [ "customChocolateySpecs" ] ;
191191
192- foreach ( var spec in specs ) {
193- var specId = ( string ) spec [ "Id" ] ;
194-
195- if ( specId == id ) {
196- return ( string ) spec [ "Version" ] ;
197- }
198- }
192+ if ( specs != null )
193+ {
194+ foreach ( var spec in specs ) {
195+ var specId = ( string ) spec [ "Id" ] ;
196+
197+ if ( specId == id ) {
198+ return ( string ) spec [ "Version" ] ;
199+ }
200+ }
201+ }
199202
200203 throw new Exception ( String . Format ( "Cannot resolve version for package:[{0}]. Neither customNuspecs nor customChocolateySpecs has it" , id ) ) ;
201204}
@@ -341,6 +344,7 @@ NuGetPackSettings[] ResolveNuGetPackSettings() {
341344
342345 packSettings . Dependencies = ResolveDependenciesForPackage ( packSettings . Id ) ;
343346
347+ Verbose ( "Adding Authors/Owners..." ) ;
344348 if ( spec [ "Authors" ] == null )
345349 packSettings . Authors = new [ ] { "SubPoint Solutions" } ;
346350 else
@@ -351,25 +355,32 @@ NuGetPackSettings[] ResolveNuGetPackSettings() {
351355 else
352356 packSettings . Owners = spec [ "Owners" ] . Select ( t => ( string ) t ) . ToArray ( ) ;
353357
358+ Verbose ( "Adding License/ProjectUrl/IconUrl..." ) ;
354359 packSettings . LicenseUrl = new System . Uri ( ( string ) spec [ "LicenseUrl" ] ) ;
355360 packSettings . ProjectUrl = new System . Uri ( ( string ) spec [ "ProjectUrl" ] ) ;
356361 packSettings . IconUrl = new System . Uri ( ( string ) spec [ "IconUrl" ] ) ;
357362
363+ Verbose ( "Adding Description/Copyright..." ) ;
358364 packSettings . Description = ( string ) spec [ "Description" ] ;
359365 packSettings . Copyright = ( string ) spec [ "Copyright" ] ;
360366
367+ Verbose ( "Adding tags..." ) ;
361368 packSettings . Tags = spec [ "Tags" ] . Select ( t => ( string ) t ) . ToArray ( ) ;
362369
363370 packSettings . RequireLicenseAcceptance = false ;
364371 packSettings . Symbols = false ;
365372 packSettings . NoPackageAnalysis = false ;
366373
367374 // files
368- var packageFiles = spec [ "Files" ] . ToArray ( ) ;
375+ var packageFilesObject = spec [ "Files" ] ;
376+
377+ Verbose ( "Adding files..." ) ;
369378
370379 // default files
371- if ( packageFiles . Count ( ) == 0 )
380+ if ( packageFilesObject == null || packageFilesObject . Select ( t => t ) . Count ( ) == 0 )
372381 {
382+ var packageFiles = packageFilesObject ;
383+
373384 Verbose ( "Adding default files - *.dll/*.xml from bin/debug" ) ;
374385
375386 var projectPath = System . IO . Path . Combine ( defaultSolutionDirectory , packSettings . Id ) ;
@@ -394,6 +405,9 @@ NuGetPackSettings[] ResolveNuGetPackSettings() {
394405 } ;
395406 }
396407 else {
408+
409+ var packageFiles = packageFilesObject ;
410+
397411 Verbose ( "Adding custom files..." ) ;
398412
399413 var nuSpecContentFiles = new List < NuSpecContent > ( ) ;
0 commit comments