我有一个 travis 构建脚本在该脚本中它打包了一个 nuget 包
dotnet pack src/Google.Analytics.SDK.Core --configuration $BUILD_CONFIGURATION --no-restore --no-build --output $NUPKG_DIR /p:NuspecFile=$NUSPEC_PATH
$NUSPEC_PATH 是一个
.nuspec
文件。我在构建中收到以下警告。
/usr/share/dotnet/sdk/2.1.301/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(198,5): warning NU5119: File '/home/travis/build/LindaLawton/google-analytics-dotnet-sdk/deploy/.nuspec' 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 [/home/travis/build/LindaLawton/google-analytics-dotnet-sdk/src/Google.Analytics.SDK.Core/Google.Analytics.SDK.Core.csproj] Successfully created package '/home/travis/build/LindaLawton/google-analytics-dotnet-sdk/NuPkg/Daimto.Google.Analytics.Tracker.SDK.1.0.0-beta.nupkg'.
我无法弄清楚它希望我在哪里添加这个
-NoDefaultExcludes
最佳答案
将标签 NoDefaultExcludes 添加到您在 pack 命令中定位的项目的 PropertyGroup 。
像这样的东西:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageType>Template</PackageType>
...
<NoDefaultExcludes>true</NoDefaultExcludes>
</PropertyGroup>
</Project>
关于nuget - 创建 nuget 包时如何使用 -NoDefaultExcludes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51102177/