【问题标题】:Cake NuGetRestore Could not locate nuget.exeCake NuGetRestore 找不到 nuget.exe
【发布时间】:2021-05-27 02:13:20
【问题描述】:

我创建了简单的 .NET5 控制台应用程序,可以使用“dotnet restore”和“dotnet run”成功运行。应用程序正在使用一个包 Newtonsoft.Json。

我想使用 NuGetRestore() 恢复 NuGet 包,但结果是“无法找到 nuget.exe”。 我在 1.1.0 版和默认配置中使用 Cake .NET Tool。

据我所知,之前我在使用 Cake 1.0.0 之前的版本时,nuget.exe 被下载到了“tools”文件夹中。

我错过了什么?如何确保 nuget.exe 由 Cake 下载/提供?

【问题讨论】:

    标签: nuget cakebuild


    【解决方案1】:

    为了将 NuGet 工具下载到 tools 文件夹,您需要在 Cake 构建脚本中包含 NuGet.CommandLine 包。例如

    #tool nuget:?package=NuGet.CommandLine&version=5.9.1
    

    相关信息:

    【讨论】:

      【解决方案2】:

      Cake 本身从未下载过 nuget.exe。 example bootstrapper for Cake Runner for .NET Framework 在某些情况下会这样做。 Example bootstrapper for Cake .NET Tool 不会下载 nuget.exe,您需要确保自己可以使用它,方法是更新引导程序、使用构建脚本中的 tool prepocessor directive 或 Cake 之外的任何其他机制。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-09-11
        • 2012-10-23
        • 1970-01-01
        • 1970-01-01
        • 2019-03-09
        • 1970-01-01
        • 2015-08-20
        • 1970-01-01
        相关资源
        最近更新 更多