Search code examples
nugetnuspec

Invalid child elements in nuspec when calling Nuget pack


When I run

nuget pack myPackage.nuspec

The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' has invalid child element 'packageSourceUrl' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'. List of possible elements expected: 'contentFiles, frameworkAssemblies, references, developmentDependency, language, releaseNotes' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.

I understand that the element is invalid and not in the xsd.

My nuspec file has 2 elements in the metadata element that will generate errors when creating the nupkg:

<metadata>      
  <mailingListUrl>http://example.com</mailingListUrl>
  <packageSourceUrl>https://example.com/</packageSourceUrl>

How can I avoid this error with the schema?


Solution

  • mailingListUrl and packageSourceUrl are not a part of the nuspec metadata element. What are you looking for? The possible nuspec metadata elements are given here.