Nuget.exe 包警告 : Description was not specified. 使用 'Description'

标签 nuget

我正在尝试通过命令行创建 NuGet 包,但我似乎无法弄清楚如何设置描述、作者、标题、摘要、发布说明和所有者。包创建成功它只是给我这个警告:

WARNING: Description was not specified. Using 'Description'.
WARNING: Author was not specified. Using 'User'.

这是我的命令:
NuGet.exe pack "<MyProjectPath>.csproj" -OutputDirectory "<MyOutputDirectory>" -Properties Configuration=release;Description="MyDescription";Authors="MeMeMe...MeToo";Title="MyTitle";Summary="MySummary";releaseNotes="MyChanges;"Owners="MyCompany"

我不确定这是否重要,但我使用的是从 Visual Studio Team Services 下载的“CredentialProviderBundle.zip”文件中的 NuGet.exe。

最佳答案

该命令实际上几乎没有任何问题。

如果没有一些先决条件,就不可能完成问题的要求。

  • 在与 *.csproj 相同的目录中必须有一个具有相同名称的 *.nuspec 文件。
  • *.nuspec 文件必须包含您尝试通过命令行设置的所有元素
  • 将通过命令行填充的所有元素都必须包含“$tokenName$”形式的标记
  • 在命令行中,您不能指定 *.nuspec 元素名称,而是指定包含在美元符号(也称为 token 名称)之间的值
  • 标记名称可能与问题中列出的所有属性的元素名称相同,但描述元素除外。 Description 元素的标记不得命名为“Description”。 “Desc”在这里工作得很好。 (这就是为什么我说问题中列出的命令几乎没有错)

  • 以下是此特定示例的 *.nuspec 文件示例:
    <?xml version="1.0"?>
    <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
        <metadata>
            <id>$Id$</id>
            <version>$Version$</version>
            <title>$Title$</title>
            <authors>$Authors$</authors>
            <owners>$Owners$</owners>
            <requireLicenseAcceptance>false</requireLicenseAcceptance>
            <description>$Desc$</description>
            <summary>$Summary$</summary>
            <releaseNotes>$ReleaseNotes$</releaseNotes>
            <copyright>Copyright ©  2016</copyright>
            <dependencies />
        </metadata>
    </package>
    

    Id 和 Version 不需要有 token ,因为无论哪种方式它们都会自动被覆盖,但这不会造成伤害。

    这是您应该与上面指定的 *.nuspec 文件一起使用的命令行:
    NuGet.exe pack "<MyProjectPath>.csproj" -OutputDirectory "<MyOutputDirectory>" -Properties Configuration=release;Desc="MyDescription";Authors="MeMeMe...MeToo";Title="MyTitle";Summary="MySummary";ReleaseNotes="MyChanges;"Owners="MyCompany"
    

    关于Nuget.exe 包警告 : Description was not specified. 使用 'Description',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40570795/

    相关文章:

    azure-devops - 用户没有权限完成此操作。您需要具有“AddPackage”

    visual-studio-2012 - 一般 NuGet 更新后,Resharper View 解析停止工作

    .net - 如何将 Nuget 包推送到 GitHub 包?

    visual-studio-2013 - 自动包恢复 : Unable to find version of package

    NuGet 包恢复不起作用

    nuget - 无法在 Visual Studio 2015 中的空白解决方案上安装 NuGet 包

    powershell - 无法安装 nuget 包,因为 "Failed to initialize the PowerShell host"

    asp.net-mvc - datatables.net : Error handling for server side processing

    .net - 使用 Chocolatey 或 nuget 来为另一个包中的工具添加插件

    ssl - 是否可以在没有 ssl 验证的情况下推送到 nuget 存储库?