Azure Pipelines:由于依赖项不符合 xsd,所以使用依赖项打包 csproj 失败?
Azure Pielines: Packing a csproj with dependencies fails because of dependencies not meeting xsd?
我有以下.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>
以及以下流水线任务定义:
- 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
虽然失败并出现以下错误:
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))
构建日志是:
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
Studio19\Enterprise\MSBuild\Current\bin'. Use option
-MSBuildVersion to force nuget to use a specific version of MSBuild. Packing files from 'D:\a\s<project
folder>\bin\Debug\netstandard2.0'. Using '.nuspec' for metadata.
我真的很困惑为什么它使用这么旧的xsd,我可以在本地构建这个解决方案,在本地打包,在本地推送,然后从私人提要中读取它就好了......但是当我尝试使用管道自动化它时,它只是不喜欢我的依赖节点。关于我做错了什么的任何线索?
我是个白痴!
在我发布的版本中,我删除了一个依赖节点项以使其更易于阅读,但是第二个依赖节点被拼写为“depnedency”,所以这完全是愚蠢的事情。将其重命名为“dependency”解决了这个问题。
真希望解析器不会告诉我我的 xsd 错了。我想它对我的信任比它应该的多。
我有以下.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>
以及以下流水线任务定义:
- 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
虽然失败并出现以下错误:
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))
构建日志是:
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 Studio19\Enterprise\MSBuild\Current\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild. Packing files from 'D:\a\s<project folder>\bin\Debug\netstandard2.0'. Using '.nuspec' for metadata.
我真的很困惑为什么它使用这么旧的xsd,我可以在本地构建这个解决方案,在本地打包,在本地推送,然后从私人提要中读取它就好了......但是当我尝试使用管道自动化它时,它只是不喜欢我的依赖节点。关于我做错了什么的任何线索?
我是个白痴!
在我发布的版本中,我删除了一个依赖节点项以使其更易于阅读,但是第二个依赖节点被拼写为“depnedency”,所以这完全是愚蠢的事情。将其重命名为“dependency”解决了这个问题。
真希望解析器不会告诉我我的 xsd 错了。我想它对我的信任比它应该的多。