quot;Could not load file or assemblyquot; when building using team city(“无法加载文件或程序集使用团队城市建造时)
问题描述
我在 Team City (8.0.4) 构建服务器上遇到了单元测试问题 - 代码构建 &通过 Resharper 和 nCrunch 在本地运行所有测试.
I'm running into an issue with unit tests on our Team City (8.0.4) build server - the code builds & runs all tests locally via Resharper and nCrunch.
但是在服务器上运行时,我得到以下错误,即使 Unity 程序集与单元测试程序集存在于同一目录中,并且在单元测试程序集中被引用.
But when running on the server I get the following error, even though the Unity assembly exists in the same directory as the unit test assembly, and is referenced in the unit test assembly.
SetUp 方法失败.SetUp:System.IO.FileNotFoundException:无法加载文件或程序集Microsoft.Practices.Unity,版本=2.0.414.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"或其依赖项之一.该系统找不到指定的文件.在 XXXX.Unity.UnityContainerAdapter..ctor()在 XXXX.GraphExtensionsTests..ctor() 在 c:TeamCityV7Agent-1workf02f7e27c0bedfa2XXXXGraph.TestsExtensionsGraphExtensionsTests.cs:line 44
SetUp method failed. SetUp : System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at XXXX.Unity.UnityContainerAdapter..ctor() at XXXX.GraphExtensionsTests..ctor() in c:TeamCityV7Agent-1workf02f7e27c0bedfa2XXXXGraph.TestsExtensionsGraphExtensionsTests.cs:line 44
我已确认 Microsoft.Practices.Unity 的副本是正确的版本.
I've confirmed the copy of Microsoft.Practices.Unity is the correct version.
我还确认程序集是使用完整版框架构建的,而不是使用客户端配置文件.
I've also confirmed the assemblies are built using the full version of the framework - not using client profile.
您知道 Team City 可能会失败的原因吗?
Any ideas why Team City might be failing?
推荐答案
检查您用来定位测试程序集的模式.我在另一个库中遇到了类似的问题,结果发现模式是在 binRelease 和 objRelease 下找到测试程序集;obj 文件夹不包含项目引用的所有程序集,实际上只是编译器的临时文件夹.
Check the pattern you're using to locate your test assemblies. I had a similar problem with another library and it turns out the pattern was finding the test assembly under binRelease and objRelease; the obj folder doesn't contain all the assemblies referenced by the project and is really just a scratch folder for the compiler.
这篇关于“无法加载文件或程序集"使用团队城市建造时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“无法加载文件或程序集"使用团队城市建造时
基础教程推荐
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01