单元测试项目从构建服务器没有建设 [英] Unit test project not building from build server
问题描述
我的VS2010的解决方案中有一个测试项目。单元测试本身参考下面的命名空间:
My VS2010 solution has a test project in it. The unit tests themselves reference the following namespace:
using Microsoft.VisualStudio.TestTools.UnitTesting;
这是通过以下组件在我的电脑上访问:
which is accessed via the following assembly on my PC:
Assembly Microsoft.VisualStudio.QualityTools.UnitTestFramework
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\
PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
当我建立我的电脑上的解决方案,我没有问题;该测试将生成并运行没问题。
When I build the solution on my PC I have no issues; the tests will build and run okay.
我们有一个内部网页,我们可以用它来揭开序幕构建一个构建服务器上。当我通过这个网页建设,构建失败,出现以下错误:
We have an intranet page which we can use to kick off builds on a build server. When I build via this page, the build fails with the following errors:
Generator.cs(3,17): error CS0234: The type or namespace name 'VisualStudio'
does not exist in the namespace 'Microsoft' (are you missing an assembly
reference?)
最明显的问题是,该 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
上述不生成服务器上present。我认为这是将与VS2010安装,并且因为在我的解决方案的项目构建.NET 4.0的目标,我希望这是构建服务器上安装。
The obvious problem would be that the Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
mentioned above is not present on the build server. I thought this was would be installed with VS2010, and since the projects in my solution build .NET 4.0 targets, I would expect this to be installed on the build server.
什么是解决最简单的方法是什么?构建服务器是我的管辖范围,我不特别要记录的作业才能安装新的库吧。
What is the easiest way to resolve this? The build server is out of my jurisdiction and I don't particular want to log a job to get new libraries installed on to it.
推荐答案
在.UnitTestFramework.dll坐落在C:\ Program Files文件夹...和你有一个参考吧。
The .UnitTestFramework.dll sits in C:\Program Files... folder and you have a reference to it.
- 在源代码控制,例如创建目录。源/二进制文件
- 该DLL复制到源/二进制文件
- 从你的单元测试组件删除提及.UnitTestFramework.dll
- 添加引用.UnitTestFramework.dll到你的单元测试组件,但这次选择的dll,现在是在源/二进制文件
之后,你可以检入您的更改(请确保源/二进制文件的文件夹被选中的),并构建解决方案。当构建服务器构建的解决方案,它应该从源头上控制该DLL。
After that you can checkin your changes (make sure the Source/Binaries folder is checked in) and build the solution. When build server builds the solution it should get the dll from the source control.
这篇关于单元测试项目从构建服务器没有建设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!