I have the following .nuspec
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>Alpha release.</releaseNotes>
<copyright>Copyright 2021</copyright>
<tags>Some tag</tags>
<dependencies>
<group targetFramework="netstandard2.0">
<dependency id="Microsoft.Extensions.Logging" version="3.1.15" />
</group>
</dependencies>
</metadata>
</package>
And the following pipeline task definition:
- task: NuGetCommand@2
inputs:
command: 'pack'
packagesToPack: '$(Build.Repository.LocalPath)\<project Folder>\<project name>.csproj'
versioningScheme: 'off'
includeSymbols: true
nugetConfigPath: $(Build.Repository.LocalPath)\<project Folder>\nuget.config
While fails with the following error:
System.InvalidOperationException: The element 'group' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' has invalid child element 'depdenency' in namespace ' at NuGet.Packaging.Manifest.<>c.b__20_0(Object sender, ValidationEventArgs e) at System.Xml.Schema.XmlSchemaValidator.ValidateElementContext(XmlQualifiedName elementName, Boolean& invalidElementInContext) at System.Xml.Schema.XmlSchemaValidator.ValidateElement(String localName, String namespaceUri, XmlSchemaInfo schemaInfo, String xsiType, String xsiNil, String xsiSchemaLocation, String xsiNoNamespaceSchemaLocation) at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e) at System.Xml.Schema.XNodeValidator.ValidateNodes(XElement e) at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e) at System.Xml.Schema.XNodeValidator.ValidateNodes(XElement e) at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e) at System.Xml.Schema.XNodeValidator.ValidateNodes(XElement e) at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e) at System.Xml.Schema.XNodeValidator.ValidateNodes(XElement e) at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e) at System.Xml.Schema.XNodeValidator.Validate(XObject source, XmlSchemaObject partialValidationType, Boolean addSchemaInfo) at NuGet.Packaging.Manifest.ValidateManifestSchema(XDocument document, String schemaNamespace) at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema) at NuGet.CommandLine.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath) at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder) at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand() at NuGet.CommandLine.Command.ExecuteCommandAsync() at NuGet.CommandLine.Command.Execute() at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args))
The build log is:
NuGet Version: 5.8.0.6930 Attempting to build package from '.csproj'. MSBuild auto-detection: using msbuild version '16.9.0.16703' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild. Packing files from 'D:\a\1\s<project folder>\bin\Debug\netstandard2.0'. Using '.nuspec' for metadata.
I am really stumped why it's using such an old xsd, and I can build this solution locally, pack it locally, and push it locally, and then read it from the private feed just fine... but when I try to automate it with a pipeline, it just does not like my dependencies node. Any clue as to what I'm doing wrong?
I'm an idiot!
In the version I posted here, I deleted one dependency node item to make it easier to read, but that second dependency node was spelled "depnedency" so this entirely something stupid. Renaming it to "dependency" fixed the issue.
Do wish the parser would've said that instead of telling me my xsd was wrong. I guess it has more faith in me than it should.