nuget - 禁止从Nuget.exe输出警告

标签 nuget octopus-deploy

我想知道是否可以在nuget.exe pack命令的输出中禁止显示警告消息?特定的消息会很棒,但是我可以忍受所有这些消息。

nuget command line documentation提到了Verbosity标志,但从未真正指定该标志的有效值。我尝试了以下方法:

nuget pack mypackage.nuspec -Verbosity Quiet

但是似乎什么也没做。

这是我要打包的nuspec的示例:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>MyPackage</id>
        <version>1.0.0</version>
        <authors>Administrator</authors>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>My package description.</description>
    </metadata>
    <files>
        <file src="mysourcepath\foo.dll" target="mytargetpath\foo.dll" />
    </files>
</package>

我得到的警告消息是这样的:
WARNING: 1 issue(s) found with package 'MyPackage'.

Issue: Assembly outside lib folder.
Description: The assembly 'mytargetpath\foo.dll' is not inside the 'lib' folder and hence it won't be added as a reference when the package is installed into a project.
Solution: Move it into the 'lib' folder if it should be referenced.

我正在创建一个nuget程序包,该程序包将通过Octopus服务器作为应用程序部署。该dll中的程序集不需要任何引用-该程序包永远不应作为构建的一部分进行引用(为此,我们还有其他更合理的程序包)。

我想抑制此警告,因为我正在创建的实际包中包含成千上万个文件,这些文件都不在lib文件夹中。此警告的输出噪音使我很难看到任何其他我可能感兴趣的合法警告。

更新:这个软件包是从一个自定义nuspec文件打包的-它包含数百个项目的输出,因此指定项目文件不是消除警告的可行选择。 FWIW,指定项目文件确实消除​​了警告,因为最终将项目输出放入lib文件夹-这是我要避免的事情。

TIA用于任何输入。

最佳答案

首先,nuget reference明确指定Verbosity的有效值。在pack命令部分下提供的链接中:

Display this amount of details in the output: normal, quiet, (v2.5) detailed.



如果可能,请尝试打包项目文件而不是.nuspec文件,将小写形式用于quiet标志,然后使用-NoPackageAnalysis:
nuget pack myproject.proj -Verbosity quiet -NoPackageAnalysis

关于nuget - 禁止从Nuget.exe输出警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36364559/

相关文章:

c++ - 使用嵌套包含文件夹创建 C++ NuGet 包

xamarin - xamarin 工作室中是否有包管理器控制台

octopus-deploy - 在 asp.net 中获取或读取使用 Octopus 部署的应用程序的版本

windows - 是否可以使用 Octopus 强制终止 Windows 服务?

octopus-deploy - OctoPack 何时创建 nuspec 文件?

asp.net-core - 如何通过 CLI 在 ASP.NET Core 项目中安装 nuget 包

msbuild - 如何将 NuGet contentFiles 提取到特定目录?

github - 使用 NuGet : Unable to load the service index error 发布和使用 GitHub 包存储库

c# - 八达通客户端,从C#中的项目名称获取版本

sql-server - 通过 Octopus 和 TeamCity 将数据库包部署到 SQL Server