@@ -493,10 +493,45 @@ private string CreateNuspec(
493493 {
494494 if ( privateData [ "PSData" ] is Hashtable psData )
495495 {
496- if ( psData . ContainsKey ( "Prerelease " ) && psData [ "Prerelease " ] is string preReleaseVersion )
496+ if ( psData . ContainsKey ( "prerelease " ) && psData [ "prerelease " ] is string preReleaseVersion )
497497 {
498498 version = string . Format ( @"{0}-{1}" , version , preReleaseVersion ) ;
499499 }
500+
501+ if ( psData . ContainsKey ( "licenseuri" ) && psData [ "licenseuri" ] is string licenseUri )
502+
503+ {
504+ metadataElementsDictionary . Add ( "license" , licenseUri . Trim ( ) ) ;
505+ }
506+
507+ if ( psData . ContainsKey ( "projecturi" ) && psData [ "projecturi" ] is string projectUri )
508+ {
509+ metadataElementsDictionary . Add ( "projectUrl" , projectUri . Trim ( ) ) ;
510+ }
511+
512+ if ( psData . ContainsKey ( "iconuri" ) && psData [ "iconuri" ] is string iconUri )
513+ {
514+ metadataElementsDictionary . Add ( "iconUrl" , iconUri . Trim ( ) ) ;
515+ }
516+
517+ if ( psData . ContainsKey ( "releasenotes" ) )
518+ {
519+ if ( psData [ "releasenotes" ] is string releaseNotes )
520+ {
521+ metadataElementsDictionary . Add ( "releaseNotes" , releaseNotes . Trim ( ) ) ;
522+ }
523+ else if ( psData [ "releasenotes" ] is string [ ] releaseNotesArr )
524+ {
525+ metadataElementsDictionary . Add ( "releaseNotes" , string . Join ( "\n " , releaseNotesArr ) ) ;
526+ }
527+ }
528+
529+ // defaults to false
530+ string requireLicenseAcceptance = psData . ContainsKey ( "requirelicenseacceptance" ) ? psData [ "requirelicenseacceptance" ] . ToString ( ) : "false" ;
531+
532+ metadataElementsDictionary . Add ( "requireLicenseAcceptance" , requireLicenseAcceptance ) ;
533+
534+
500535 if ( psData . ContainsKey ( "Tags" ) && psData [ "Tags" ] is Array manifestTags )
501536 {
502537 var tagArr = new List < string > ( ) ;
@@ -525,21 +560,11 @@ private string CreateNuspec(
525560 metadataElementsDictionary . Add ( "owners" , parsedMetadataHash [ "companyname" ] . ToString ( ) . Trim ( ) ) ;
526561 }
527562
528- // defaults to false
529- var requireLicenseAcceptance = parsedMetadataHash . ContainsKey ( "requirelicenseacceptance" ) ? parsedMetadataHash [ "requirelicenseacceptance" ] . ToString ( ) . ToLower ( ) . Trim ( )
530- : "false" ;
531- metadataElementsDictionary . Add ( "requireLicenseAcceptance" , requireLicenseAcceptance ) ;
532-
533563 if ( parsedMetadataHash . ContainsKey ( "description" ) )
534564 {
535565 metadataElementsDictionary . Add ( "description" , parsedMetadataHash [ "description" ] . ToString ( ) . Trim ( ) ) ;
536566 }
537567
538- if ( parsedMetadataHash . ContainsKey ( "releasenotes" ) )
539- {
540- metadataElementsDictionary . Add ( "releaseNotes" , parsedMetadataHash [ "releasenotes" ] . ToString ( ) . Trim ( ) ) ;
541- }
542-
543568 if ( parsedMetadataHash . ContainsKey ( "copyright" ) )
544569 {
545570 metadataElementsDictionary . Add ( "copyright" , parsedMetadataHash [ "copyright" ] . ToString ( ) . Trim ( ) ) ;
@@ -555,20 +580,6 @@ private string CreateNuspec(
555580 }
556581 metadataElementsDictionary . Add ( "tags" , tags ) ;
557582
558- if ( parsedMetadataHash . ContainsKey ( "licenseurl" ) )
559- {
560- metadataElementsDictionary . Add ( "licenseUrl" , parsedMetadataHash [ "licenseurl" ] . ToString ( ) . Trim ( ) ) ;
561- }
562-
563- if ( parsedMetadataHash . ContainsKey ( "projecturl" ) )
564- {
565- metadataElementsDictionary . Add ( "projectUrl" , parsedMetadataHash [ "projecturl" ] . ToString ( ) . Trim ( ) ) ;
566- }
567-
568- if ( parsedMetadataHash . ContainsKey ( "iconurl" ) )
569- {
570- metadataElementsDictionary . Add ( "iconUrl" , parsedMetadataHash [ "iconurl" ] . ToString ( ) . Trim ( ) ) ;
571- }
572583
573584 // Example nuspec:
574585 /*
@@ -581,7 +592,7 @@ private string CreateNuspec(
581592 <owners>Microsoft,PowerShell</owners>
582593 <requireLicenseAcceptance>false</requireLicenseAcceptance>
583594 <license type="expression">MIT</license>
584- <licenseUrl >https://licenses.nuget.org/MIT</licenseUrl >
595+ <license >https://licenses.nuget.org/MIT</license >
585596 <icon>Powershell_black_64.png</icon>
586597 <projectUrl>https://github.com/PowerShell/PowerShell</projectUrl>
587598 <description>Example description here</description>
0 commit comments