如何修复 nuget 包上元素'元数据'中的"无效元素'许可证'



我正在对包含"许可证"标签的 nuget 文件调用 Nuget Pack

license type="expression">MIT</license>  

Nuget 包因此失败。

我尝试下载最新的nuget.exe并将其放入文件夹中,然后使用" cd"更改目录并再次调用。仍然失败。

确切的错误消息是

The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' has invalid child element 'license' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'. List of possible elements expected: 'references, frameworkAssemblies, releaseNotes, iconUrl, summary, language, copyright, developmentDependency, serviceable, description, dependencies, repository, packageTypes, contentFiles, projectUrl, licenseUrl, tags' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'. This validation error occurred in a 'license' element.

根据zivkan的回答,我解决了这个问题。 正如他所说,我正在运行旧版本的nuget。 从 nuget 更新而不是下载二进制文件有效。 要更新,请运行

nuget update -self

请注意,您可能需要以管理员身份运行。

最新更新