TFS没有部署引用的程序集时,测试目录生成服务器上 [英] TFS not deploying referenced assembly to test dir when on build server

查看:240
本文介绍了TFS没有部署引用的程序集时,测试目录生成服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有codeD-UI测试项目中引用了在溶液中的其他组件。不知怎的,有些组件将不会被复制到 TestResults /输出目录中,而另一些被复制。所有组件都复制本地选项(不知道是不是真的,虽然事项),并在其他绝对平等选项​​。当我在本地启动测试从VS2010所有的组件都被复制,而不是在生成服务器上。

I have Coded-UI test project that has references to other assemblies in solution. Somehow some assemblies are not copied to TestResults/Out directory, while others are copied. All assemblies have Copy Local option true (don't know if it really matters though) and are absolutely equal in other options. All assemblies are copied when I start test locally from VS2010, but not when on build server.

如果我用 [DeploymentItem] 属性,兵力部署,他们成功地部署这些淘气组件。

If I use [DeploymentItem] attribute to force deployment of these "naughty" assemblies they deploy successfully.

我无法得到它 - 我一直认为,如果你引用组件(在引用解决方案资源管理器部分),该组件将被复制到 TestResults /输出 [DeploymentItem] 需要复制一些的.xml和其他配置文件。

I can't get it - I've always thought that if you reference assembly (in References section of Solution Explorer) that assembly will be copied to TestResults/Out and [DeploymentItem] is needed to copy some .xml and other config files.

推荐答案

我以前见过这个。您的测试项目引用的其他项目,但是当运行的测试,你会发现,程序集是不是present在TestRun Out文件夹。

I've seen this before. Your test project references other projects but when the tests run you'll notice that the assemblies are not present in the TestRun Out folder.

不同于从一个固定的位置运行单元测试等测试运行,MSTest的副本,它需要的地方执行测试试运行文件夹中的程序集。该设计可以让你测试运行之间的比较试验结果,覆盖范围,输出。

Unlike other test runners that run unit tests from a fixed location, MSTest copies the assemblies that it requires to a test run folder where the tests are executed. The design allows you to compare test results, coverage, outputs between test runs.

常见的误解是,在某种程度上的测试编译设置的如复制本地会以某种方式影响使用哪些依赖的 的,这是不正确的。 MSTest的使用反射,以确定所需要的测试运行的程序集引用。

The common misconception is that somehow compilation settings like "Copy Local" will somehow influence which dependencies are used for testing, which is simply not true. MSTest uses reflection to determine assembly references that are required for the test run.

您所看到的错误很可能会造成的,因为你所引用的组件,但试件不能直接使用它。您可以通过使用IL检查实用工具(DotPeek,反射器等),来看看测试程序集引用验证这一点。 (这往往是在引用的XAML组件WPF项目有问题。)

The error you are seeing is likely caused because you've referenced the assembly but the test assembly is not directly using it. You can verify this by using a IL inspection utility (DotPeek, Reflector, etc) to look at the test-assembly references. (This is often a problem in WPF projects that reference assemblies in the XAML.)

要解决,要么使用DeploymentSettings到装配复制到输出文件夹;或使用该组件的测试项目。例如,添加以下到您的测试项目将发出IL,确保大会的部署:

To fix, either use the DeploymentSettings to copy the assembly to the output folder; or use the assembly in the test project. For example, adding the following to your test project will emit IL that ensures the assembly is deployed:

var type = typeof(AssemblyNotBeingCopied.MyClass);

这篇关于TFS没有部署引用的程序集时,测试目录生成服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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