使用nuspec文件时如何摆脱nuget警告?

时间:2018-11-11 20:09:37

标签: nuget nuspec

我具有以下目录结构:

C:\xyz\Automation [master ≡ +2 ~0 -0 !]> dir -Recurse -File -Name
.gitattributes
.gitignore
Build\Bootstrap.ps1
Build\Build.ps1
Build\DevOpsAutomation.nuspec
vNext\Config.ps1
vNext\QueryBuildDefinition.ps1
vNext\QueueBuild.ps1
vNext\.vscode\launch.json
C:\xyz\Automation [master ≡ +2 ~0 -0 !]>

我的目标是生产一个NuGet软件包,其中包含以下各项以外的所有内容:

  1. ** /。git *-这应该同时排除.git文件夹和任何.gitXYZ文件
  2. ** /。vs *-应该在任何位置覆盖.vs和.vscode文件夹
  3. 内部版本-应该覆盖内部Build文件夹

Build \ DevOpsAutomation.nuspec是:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>DevOpsAutomation</id>
    <version>$version$</version>
    <title>DevOps Automation</title>
    <authors>Arch DevOps</authors>
    <owners>xyz</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Contains various scripts to automate vNext and Octopus pipelines.</description>
    <copyright>Copyright 2018</copyright>
    <tags>vnext vsts tfs octopus automation</tags>
  </metadata>
  <files>
     <file src="**" exclude="Build/**;**/.git/**;**/.vs*/**"/>
  </files>
</package>

命令行为:

nuget pack Build\DevOpsAutomation.nuspec -BasePath '.' -Version '1.0.0.0' -NoPackageAnalysis

似乎可行:

C:\xyz\Automation [master ≡ +3 ~1 -0 ~]> del .\DevOpsAutomation.1.0.0.nupkg
C:\xyz\Automation [master ≡ +3 ~1 -0 ~]> $nuget
C:\Users\me\.nuget\nuget.exe
C:\xyz\Automation [master ≡ +3 ~1 -0 ~]> &$nuget pack Build\DevOpsAutomation.nuspec -Version '1.0.0.0' -BasePath '.' -NoPackageAnalysis
Attempting to build package from 'DevOpsAutomation.nuspec'.
WARNING: NU5119: File 'C:\xyz\Automation\.gitattributes' was not added to the package. Files and folders starting with '.' or ending with '.nupkg' are excluded by default. To include this file, use -NoDefaultExcludes from the commandline
WARNING: NU5119: File 'C:\xyz\Automation\.gitignore' was not added to the package. Files and folders starting with '.' or ending with '.nupkg' are excluded by default. To include this file, use -NoDefaultExcludes from the commandline
C:\xyz\Automation [master ≡ +3 ~1 -0 ~]>

生成的nupkg包含我所需的内容,当前仅是vNext文件夹。但是,警告使我烦恼。是否有可能抑制它们,最好是从nuspec文件本身中抑制它们?

0 个答案:

没有答案