【问题标题】:NuGet pack looking for dependency in wrong folderNuGet 包在错误的文件夹中寻找依赖项
【发布时间】:2019-03-31 14:44:43
【问题描述】:

我有多个解决方案,可以通过 NuGet 源(由 TeamCity 驱动,2018.1.3(内部版本 58658))相互共享包。解决方案A 向 NuGet 提要公开了几个项目,来自解决方案 B 的项目引用了其中一些包。 SolutionB 中的一些项目也应该打包并发布到 NuGet 源。 对于解决方案,打包和发布非常完美。对于解决方案B,依赖于从解决方案A 发布到 NuGet 的包的项目打包因奇怪的问题而失败。当 TeamCity 执行 NuGet 包还原步骤时,包被下载到 packages\Project.From.SolutionA.3.181.181\ 文件夹。然后构建步骤成功完成,但打包步骤失败,因为 NuGet pack 命令在文件夹 packages\Project.From.SolutionA\3.181.181\ 中查找包! 以下是 pack 命令的构建日志(NuGet 版本为 4.8.1)

Missing <TeamCityDir>\buildAgent\work\fbb25b8e9614747\packages\Project.From.SolutionA\3.181.181\Project.From.SolutionA.3.181.181.nupkg
    Error NU5012: Unable to find 'Project.From.SolutionA.3.181.181.nupkg'. Make sure the project has been built.
    NuGet.Packaging.Core.PackagingException: Unable to find 'Project.From.SolutionA.3.181.181.nupkg'. Make sure the project has been built.
    at NuGet.CommandLine.ProjectFactory.AddDependencies(Dictionary`2 packagesAndDependencies)
    at NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder builder)
    at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
    at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
    at NuGet.Commands.PackCommandRunner.BuildPackage()
    at NuGet.CommandLine.PackCommand.ExecuteCommand()
    at NuGet.CommandLine.Command.ExecuteCommandAsync()
    at NuGet.CommandLine.Command.Execute()
    at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)

唯一被替换的是项目的真实路径和名称

【问题讨论】:

    标签: nuget teamcity nuget-package


    【解决方案1】:

    您是否确保解决方案中的解决方案文件不超过一个 (.sln)?我正在处理一个具有主解决方案文件的旧项目,然后一些子项目有自己的解决方案文件。当我在 TeamCity 中运行构建时,它会在尝试查找第一个 nuget 包并报告错误时失败:

    Error NU5012: Unable to find 'package.version.nupkg'. Make sure the project has been built.
    

    花了一段时间,但我意识到失败的项目都有自己的解决方案文件,这让 TeamCity 感到困惑。删除文件后,构建工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-03
      • 1970-01-01
      相关资源
      最近更新 更多