【发布时间】:2017-03-03 15:27:22
【问题描述】:
我正在尝试使用 Team Services 进行持续集成以适用于我的解决方案。我的解决方案在本地构建,没有任何问题。 Nuget Install 上的构建过程失败:
Error: D:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.29\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe failed with return code: 1
Packages failed to install
解决方案或 packages.config 的路径设置为 SLN 文件名 (boilerplate.sln) 安装类型设置为 INSTALL
我不想设置 package.config 的路径,因为我在此解决方案中有多个项目。
如果我将安装类型设置为 RESTORE,Nuget 恢复任务会通过,但构建解决方案会失败并出现一堆警告和错误:
Warnings: (one of many but all similar)
C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1820,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Errors: (one of many but all similar)
src\DB\BoilerPlate.Data.Context\BoilerPlateContext.cs(3,23): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
我只是不明白这个过程是如何工作的,请帮助我是新手。
我的文件夹结构如下:
BoilerPlate.sln
packages
src
src\db
src\DB\BoilerPlate.Data.Context\
src\DB\BoilerPlate.Data.Context\package.config
src\DB\BoilerPlate.Data.Entities\
【问题讨论】:
-
"Restore" 是您正在寻找的。看起来实体框架可能没有安装在构建服务器上的全局程序集缓存中。检查 EntityFramework 是否作为 NuGet 包安装在您的解决方案中。
-
@jessehouwing 实体作为 NuGet 包安装。
-
但它看起来像是从 GAC 加载的,否则错误消息将显示它期望程序集所在的路径。你能检查一下项目文件中的
<reference元素,看看它是否有指向包目录的提示路径吗? -
@jessehouwing 引用 EntityFramework 的路径设置为我的 repo 中的包文件夹。
-
..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
标签: continuous-integration nuget azure-devops