“无法加载文件或程序集"使用团队城市构建时 [英] "Could not load file or assembly" when building using team city

查看:23
本文介绍了“无法加载文件或程序集"使用团队城市构建时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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.

设置方法失败.设置:System.IO.FileNotFoundException:无法加载文件或程序集Microsoft.Practices.Unity,Version=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.

这篇关于“无法加载文件或程序集"使用团队城市构建时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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