我想知道是否可以在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/