nuget - 创建 nuget 包时如何使用 -NoDefaultExcludes

标签 nuget travis-ci

我有一个 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
  • 我尝试将它添加为自己的命令,但失败了。
  • 我尝试将它添加到 dotnet 包中,但它也不起作用
  • 我曾尝试将文件重命名为 .xml,但它也不起作用。
  • 最佳答案

    将标签 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/

    相关文章:

    visual-studio-2013 - Nuget:远程服务器返回错误:(504) 网关超时

    .net - nuget.exe 更新为新的 csproj 格式

    travis-ci - 从 Travis CI 获取失败测试的屏幕截图

    php - 在 Github repo 上显示 "build"按钮

    node.js - 特拉维斯 CI : unable to upgrade npm version

    nuget - 什么是 nuget props 文件,它的用途是什么?

    c# - Visual Studio 2015 update 3 无法读取 NuGet 包

    jquery - 创建 MVC 4 项目并更新 jquery - 获取 "Microsoft JScript runtime error: Object expected"

    perl - 使用 Travis CI(使用 docker)对 Perl 存储库进行本地测试

    travis-ci - 特拉维斯 : different `script` for different branch?