我刚刚在我的 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,升级它不是一种选择。谁能建议可能导致差异的原因以及我可以做些什么来成功构建测试项目?
谢谢