简体   繁体   English

为什么我无法使用项目解决方案文件在 Msbuild Teamcity 中构建测试项目?

[英]Why i cannot build the test project in Msbuild Teamcity using the project solution file?

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

16:42:40 UnitTest1.cs(131,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) 16:42:40 UnitTest1.cs(131,10):错误 CS0246:找不到类型或命名空间名称“TestMethod”(您是否缺少 using 指令或程序集引用?)

16:42:40 UnitTest1.cs(144,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) 16:42:40 UnitTest1.cs(144,10):错误 CS0246:找不到类型或命名空间名称“TestMethodAttribute”(您是否缺少 using 指令或程序集引用?)

Why i cannot build the test project in Msbuild Teamcity using the project solution file?为什么我无法使用项目解决方案文件在 Msbuild Teamcity 中构建测试项目?

First of all, you should make sure that you can build your test project successfully locally.首先,您应该确保您可以在本地成功构建您的测试项目。

Then, follow these suggestions:然后,请遵循以下建议:

Suggestions建议

First , Before Teamcity 9.1.5 , you should install Microsoft Visual Studio edition on the build agent and make sure that you install the right version.首先,在Teamcity 9.1.5之前,您应该在构建代理上安装Microsoft Visual Studio edition ,并确保您安装了正确的版本。 Please see this official document .请看 这个官方文档

Since TeamCity 9.1.5 , the Visual Studio Test Runner supports Visual Studio Test Agent installed on the agent machine (Microsoft Visual Studio is no longer required).TeamCity 9.1.5开始,Visual Studio Test Runner 支持安装在代理机器上的 Visual Studio Test Agent(不再需要 Microsoft Visual Studio)。 You can refer to this link .你可以参考这个链接

Second , you should do the restoration of the nuget packages at VCS before build step.其次,您应该在构建步骤之前在 VCS 中恢复 nuget 包。

See this .看到这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM