c# – Nuget包的teamcity构建失败

我通过Nuget Autoumapper和NUnit包添加到我的解决方案中
他们工作得很好,项目在我的电脑中编译.

当我声明构建服务器构建此解决方案时,我得到了以下消息:

[MSBuild] AutoMapper\AutoMapperSpike.csproj: Build default targets (1s)
[10:35:50][AutoMapper\AutoMapperSpike.csproj] ResolveAssemblyReferences
[10:35:50][ResolveAssemblyReferences] ResolveAssemblyReference
[10:35:50][ResolveAssemblyReference] Primary reference "AutoMapper".
[10:35:50][ResolveAssemblyReference] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "AutoMapper". Check to make sure the assembly exists on disk. If this reference is required by your code,you may get compilation errors.
[10:35:50][ResolveAssemblyReference]         For SearchPath "{HintPathFromItem}".
[10:35:50][ResolveAssemblyReference]         Considered "..\packages\AutoMapper.2.2.1\lib\net40\AutoMapper.dll",but it didn't exist.

有谁知道如何解决这个问题?

我注意到的另一件事是它使用packages文件夹在构建服务器中创建了artificts.
它唯一能做的就是在构建服务器中构建项目.

解决方法

在Visual Studio环境中,UI中有一个选项,用于在用户配置文件上设置值,因此您无需再次记住它.但是,在构建服务器上,没有这样的选项.相反,您必须将环境变量“EnableNuGetPackageRestore”设置为“true”作为构建的一部分.

我建议不要尝试在构建脚本或.csproj文件中设置环境变量. Here’s the blog article all about why it happened and what to set on your dev machine/build server.

相关文章

原文地址:http://msdn.microsoft.com/en-us/magazine/cc163...
前言 随着近些年微服务的流行,有越来越多的开发者和团队所采...
最近因为比较忙,好久没有写博客了,这篇主要给大家分享一下...
在多核CPU在今天和不久的将来,计算机将拥有更多的内核,Mic...
c语言输入成绩怎么判断等级
字符型数据在内存中的存储形式是什么