加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – Nuget包的teamcity构建失败

发布时间:2020-12-15 04:12:24 所属栏目:百科 来源:网络整理
导读:我通过Nuget Autoumapper和NUnit包添加到我的解决方案中 他们工作得很好,项目在我的电脑中编译. 当我声明构建服务器构建此解决方案时,我得到了以下消息: [MSBuild] AutoMapperAutoMapperSpike.csproj: Build default targets (1s)[10:35:50][AutoMapperAu
我通过Nuget Autoumapper和NUnit包添加到我的解决方案中
他们工作得很好,项目在我的电脑中编译.

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

[MSBuild] AutoMapperAutoMapperSpike.csproj: Build default targets (1s)
[10:35:50][AutoMapperAutoMapperSpike.csproj] ResolveAssemblyReferences
[10:35:50][ResolveAssemblyReferences] ResolveAssemblyReference
[10:35:50][ResolveAssemblyReference] Primary reference "AutoMapper".
[10:35:50][ResolveAssemblyReference] C:WindowsMicrosoft.NETFrameworkv4.0.30319Microsoft.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 "..packagesAutoMapper.2.2.1libnet40AutoMapper.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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读