Как избавиться от предупреждений nuget при использовании файла nuspec? - PullRequest
0 голосов
/ 11 ноября 2018

У меня следующая структура каталогов:

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 \ 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?

...