带有nuget包的AppHarbor构建错误 [英] AppHarbor build error with nuget packages

查看:99
本文介绍了带有nuget包的AppHarbor构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从bitbucket部署到AppHarbor时出现构建错误.这与其中一个项目无法解决应该来自Nuget的依赖项有关.一切都可以在我的机器上构建并正常运行.知识-我非常熟悉Nuget和经验丰富的开发人员.我可能是由于本地混排文件夹并重新创建了bitbucket存储库而造成的.我已经检查了bitbucket的来源,与本地相比,似乎所有东西都在那里.

I'm getting a build error when deploying to AppHarbor from bitbucket. It's related to one of the projects not being able to resolve a dependency which should come from Nuget. Everything builds and runs fine on my machine. Knowledge - I am very well versed with Nuget and an experienced dev. I probably caused this by shuffling folders around locally and recreating the bitbucket repo. I've checked the bitbucket source and it seems everything is there compared to local.

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

model是一个核心/模型类库项目. web是一个Web应用程序(webapi2 + html),它依赖于模型.两者都可以正确构建并且可以在本地机器上正常运行,但是最近我在Bitbucket上遇到了一些问题,因此我在磁盘上四处移动内容并创建了一个新的存储库.仅当将其交付给Appharbor时,这才破坏了构建.

model is a core/models class library project. web is a web application (webapi2 + html) which takes a dependency on model. Both build correctly and run fine on my local box, but I recently had some issues with Bitbucket so I moved stuff around on disk and created a new repository. This broke the build only when it gets shipped up to Appharbor.

两个项目都打开了Nuget软件包还原.

Nuget package restore is turned on for both projects.

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包的引用.那会级联并破坏构建.

As you can see the "model" (#4) project is unable to resolve references for the MongoRepository nuget package. That cascades and breaks the build.

<?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>

推荐答案

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目录.

Needed to change the HintPath to ..\packages to remove the web directory.

这篇关于带有nuget包的AppHarbor构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆