MSBuild在自动化测试项目上失败

4

我刚把一个自动化测试项目添加到我的C#解决方案中并提交到了我的构建服务器。

当使用MSBuild (.NET Framework 3.5)运行构建脚本时,它会给我返回几个错误(例如以下错误):

**cs(2,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

**.cs(21,17): error CS0246: The type or namespace name 'TestContext' could not be found (are you missing a using directive or an assembly reference?)

**.cs(73,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)

**.cs(73,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)

**.cs(14,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?)

**.cs(14,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?)

当我在我的电脑上运行.NET 3.5 msbuild时,它能够正确构建。
构建服务器上没有安装.NET 4.0,也不能升级。有人能否建议是什么原因导致这种差异,并提供解决方法使测试项目成功构建?
感谢。

你在构建服务器上安装了Visual Studio吗? - Rowland Shaw
不,我的构建服务器上没有安装Visual Studio。我认为mstest(我还没有执行)是.NET框架的一部分。是否有任何方法可以在构建服务器上构建和运行自动化测试而无需安装Visual Studio,或者我需要将测试放在单独的解决方案中,并仅在本地计算机上运行它们? - Adam Nelson
我认为你必须在测试服务器上安装测试部分;尽管我遇到了其他仍未解决的问题。 - Rowland Shaw
将测试框架更改为 Nunit。 - James Woolfenden
1个回答

2

2
我最终选择了将我的测试框架改为NUnit,但还是谢谢你。 - Adam Nelson
1
这个链接似乎指向惠普? - Lee Englestone
有趣的是... shunra.com 似乎重定向到 HP。 - Derrick

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接