@@ -493,10 +493,45 @@ private string CreateNuspec(
493
493
{
494
494
if ( privateData [ "PSData" ] is Hashtable psData )
495
495
{
496
- if ( psData . ContainsKey ( "Prerelease " ) && psData [ "Prerelease " ] is string preReleaseVersion )
496
+ if ( psData . ContainsKey ( "prerelease " ) && psData [ "prerelease " ] is string preReleaseVersion )
497
497
{
498
498
version = string . Format ( @"{0}-{1}" , version , preReleaseVersion ) ;
499
499
}
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
+
500
535
if ( psData . ContainsKey ( "Tags" ) && psData [ "Tags" ] is Array manifestTags )
501
536
{
502
537
var tagArr = new List < string > ( ) ;
@@ -525,21 +560,11 @@ private string CreateNuspec(
525
560
metadataElementsDictionary . Add ( "owners" , parsedMetadataHash [ "companyname" ] . ToString ( ) . Trim ( ) ) ;
526
561
}
527
562
528
- // defaults to false
529
- var requireLicenseAcceptance = parsedMetadataHash . ContainsKey ( "requirelicenseacceptance" ) ? parsedMetadataHash [ "requirelicenseacceptance" ] . ToString ( ) . ToLower ( ) . Trim ( )
530
- : "false" ;
531
- metadataElementsDictionary . Add ( "requireLicenseAcceptance" , requireLicenseAcceptance ) ;
532
-
533
563
if ( parsedMetadataHash . ContainsKey ( "description" ) )
534
564
{
535
565
metadataElementsDictionary . Add ( "description" , parsedMetadataHash [ "description" ] . ToString ( ) . Trim ( ) ) ;
536
566
}
537
567
538
- if ( parsedMetadataHash . ContainsKey ( "releasenotes" ) )
539
- {
540
- metadataElementsDictionary . Add ( "releaseNotes" , parsedMetadataHash [ "releasenotes" ] . ToString ( ) . Trim ( ) ) ;
541
- }
542
-
543
568
if ( parsedMetadataHash . ContainsKey ( "copyright" ) )
544
569
{
545
570
metadataElementsDictionary . Add ( "copyright" , parsedMetadataHash [ "copyright" ] . ToString ( ) . Trim ( ) ) ;
@@ -555,20 +580,6 @@ private string CreateNuspec(
555
580
}
556
581
metadataElementsDictionary . Add ( "tags" , tags ) ;
557
582
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
- }
572
583
573
584
// Example nuspec:
574
585
/*
@@ -581,7 +592,7 @@ private string CreateNuspec(
581
592
<owners>Microsoft,PowerShell</owners>
582
593
<requireLicenseAcceptance>false</requireLicenseAcceptance>
583
594
<license type="expression">MIT</license>
584
- <licenseUrl >https://licenses.nuget.org/MIT</licenseUrl >
595
+ <license >https://licenses.nuget.org/MIT</license >
585
596
<icon>Powershell_black_64.png</icon>
586
597
<projectUrl>https://github.com/PowerShell/PowerShell</projectUrl>
587
598
<description>Example description here</description>
0 commit comments