使用 TeamCity 构建 MSpec 测试
我正在尝试设置 TeamCity。最初,我遇到了各种问题,但经过多次尝试和错误,我成功地进行了构建。所以我知道我可以获得解决方案的精简版本来成功构建。
然而,有问题的项目之一是我的 MSpec 测试。当我配置解决方案来构建 MSpec 测试项目时,出现以下错误:
Areas\Manufacturing\Controllers\DashboardControllerSpecs.cs(7, 30): 错误 CS0234: 命名空间“CompanyName.ApplicationName”中不存在类型或命名空间名称“Hosts”(是否缺少程序集引用?)< /p>
事实是,它在我的本地计算机上构建“良好”,但在构建服务器(恰好位于我的本地计算机上)上,我收到上面的错误。
我可能做错了什么?我应该检查哪些事情来找出我做错了什么?
I am trying to set up TeamCity. Initially, I ran into various issues but after much trial and error, I managed to perform a successful build. So I know that I can get a cut down version of my solution to build successfully.
However, one of the items that was problematic was my MSpec test. When I configured my solution to build the MSpec test project I get the following erro:
Areas\Manufacturing\Controllers\DashboardControllerSpecs.cs(7, 30): error CS0234: The type or namespace name 'Hosts' does not exist in the namespace 'CompanyName.ApplicationName' (are you missing an assembly reference?)
The fact is that it builds "fine" on my local machine but on the build server, which happens to be on my local machine, I get the error above.
What could I be doing wrong? What are the things that I should be checking to find out what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最明显的一个当然是,您是否对不在
GAC< 上的所有引用程序集进行 bin 部署(将
Copy to Local
选项设置为true
) /代码>?您可能需要特别检查
Machine.Specifications
dll 是否设置为Copy to Local
。Hosts
是您应用中的类型或命名空间吗?无论如何,它不是 Mspec 的一部分,我刚刚检查过。The most obvious one is of course, are you bin deploying (setting the
Copy to Local
option totrue
) all the references assemblies that are not on theGAC
?You might want to particularly check that the
Machine.Specifications
dll is set toCopy to Local
.Is
Hosts
a type or namespace in your app? It's not part of Mspec in any case, I've just checked.好吧,
我想我已经发现我做错了什么。实际上,我们在 MSBuild 文件中进行版本编号。目标名称被指定为“BeforeBuild”。为了让 TeamCity 构建它,我最终将其更改为“构建”。最终结果是,在没有 Spec 项目的情况下,TeamCity 构建得很好,但当 Spec 项目包含在构建中时,就遇到了麻烦。
我什至不知道为什么会发生这种情况。但是,解决方案是删除 MSBuild 文件中的该部分,并让 TeamCity 管理版本编号。
Ok,
I think I've found what I was doing wrong. Effectively, we were doing version numbering in the MSBuild file. The target name was specified as "BeforeBuild". To get TeamCity to build this, I ended up changing this to "Build". The end result was that without the Spec project, TeamCity was building this fine but had trouble with it when the Spec project was included in the build.
I don't know enough to even speculate why this was happening. However, the solution was to remove the section in the MSBuild file and let TeamCity manage version numbering.