【问题标题】:AppHarbor build error with nuget packages使用 nuget 包的 AppHarbor 构建错误
【发布时间】:2014-02-07 05:32:16
【问题描述】:

从 bitbucket 部署到 AppHarbor 时出现构建错误。它与无法解决应该来自 Nuget 的依赖项的项目之一有关。一切都在我的机器上构建并运行良好。知识 - 我非常精通 Nuget 和经验丰富的开发人员。我可能是通过在本地改组文件夹并重新创建 bitbucket repo 造成的。我检查了 bitbucket 源,与本地相比,似乎一切都在那里。

我的解决方案的结构类似于:

\repo\app.sln
\repo\model\model.csproj
\repo\web\web.csproj

model 是一个核心/模型类库项目。 web 是一个依赖于模型的网络应用程序(webapi2 + html)。两者都可以正确构建并且在我的本地机器上运行良好,但我最近遇到了 Bitbucket 的一些问题,所以我在磁盘上移动了一些东西并创建了一个新的存储库。只有当它被运送到 Appharbor 时,它才会破坏构建。

两个项目都启用了 Nuget 包恢复功能。

这是 AppHarbor 构建过程的日志顶部:

Build started 2/7/2014 5:19:58 AM.
     1>Project "D:\temp\g0q2xqui.baf\input\app.sln" on node 1 (default targets).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Release|Any CPU".
     1>Project "D:\temp\g0q2xqui.baf\input\app.sln" (1) is building "D:\temp\g0q2xqui.baf\input\web\web.csproj" (2) on node 1 (default targets).
     2>RestorePackages:
         "D:\temp\g0q2xqui.baf\input\.nuget\NuGet.exe" install "packages.config" -source ""  -NonInteractive -RequireConsent -solutionDir "D:\temp\g0q2xqui.baf\input\ "
     1>Project "D:\temp\g0q2xqui.baf\input\app.sln" (1) is building "D:\temp\g0q2xqui.baf\input\model\model.csproj" (4) on node 2 (default targets).
     4>RestorePackages:
         "D:\temp\g0q2xqui.baf\input\.nuget\NuGet.exe" install "packages.config" -source ""  -NonInteractive -RequireConsent -solutionDir "D:\temp\g0q2xqui.baf\input\ "
     2>RestorePackages:
         Restoring NuGet packages...
         To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
         All packages listed in packages.config are already installed.
     4>RestorePackages:
         Restoring NuGet packages...
         To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
         All packages listed in packages.config are already installed.
       ResolveAssemblyReferences:
         Primary reference "MongoDB.Bson".
     4>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "MongoDB.Bson". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\temp\g0q2xqui.baf\input\model\model.csproj]
                 For SearchPath "{HintPathFromItem}".

如您所见,“模型”(#4)项目无法解析 MongoRepository nuget 包的引用。这会级联并破坏构建。

这是模型项目的 packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="mongocsharpdriver" version="1.8.3" targetFramework="net45" />
  <package id="MongoRepository" version="1.6.3" targetFramework="net45" />
</packages>

【问题讨论】:

    标签: visual-studio-2012 nuget bitbucket appharbor


    【解决方案1】:

    将 HintPath 更改为 ..\packages 对我不起作用,但将其更改为 $(Solutiondir)\packages 对我来说就像一个魅力。

    【讨论】:

      【解决方案2】:

      csproj 中有一些路径被破坏:

        <ItemGroup>
          <Reference Include="MongoDB.Bson">
            <HintPath>..\web\packages\mongocsharpdriver.1.8.3\lib\net35\MongoDB.Bson.dll</HintPath>
          </Reference>
          <Reference Include="MongoDB.Driver">
            <HintPath>..\web\packages\mongocsharpdriver.1.8.3\lib\net35\MongoDB.Driver.dll</HintPath>
          </Reference>
          <Reference Include="MongoRepository.Net45, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
            <SpecificVersion>False</SpecificVersion>
            <HintPath>..\packages\MongoRepository.1.6.3\lib\net45\MongoRepository.Net45.dll</HintPath>
          </Reference>
          <Reference Include="System" />
          <Reference Include="System.Core" />
          <Reference Include="System.Xml.Linq" />
          <Reference Include="System.Data.DataSetExtensions" />
          <Reference Include="Microsoft.CSharp" />
          <Reference Include="System.Data" />
          <Reference Include="System.Xml" />
        </ItemGroup>
      

      需要将 HintPath 更改为 ..\packages 以删除 web 目录。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-04-28
        • 1970-01-01
        • 2020-02-23
        • 1970-01-01
        • 2018-10-02
        • 2017-05-10
        • 2021-10-02
        • 1970-01-01
        相关资源
        最近更新 更多