Why does TeamCity miss a reference and fails compilation?

与世无争的帅哥 提交于 2019-12-07 11:41:48

问题


I'm completely new to TeamCity and I'm using a simple Visual Studio 2008 solution to learn it.

My solution has 2 projects: ConsoleApplication1 and ClassLibrary1.

ConsoleApplication1 has a reference to ClassLibrary1. The solution compiles with no problem in VS directly.

However, when I try to compile the same solution in TeamCity, it fails with error:

Program.cs(13, 25): error CS0246: The type or namespace name 'ClassLibrary1' could not be found (are you missing a using directive or an assembly reference?)

As far as I understand, the .sln file contains the required information to retrieve the dependency project.

What can I do help TeamCity cmpile the solution?


回答1:


Check the build log for any MSBuild produced errors and warnings.

Check you have defined a reference to the project, but not to the output of the project.

Check the compilation of ClassLibrary1 succeedes.

Yes, .sln file should contain the required information.

Could you please try running the build from console using msbuild.exe. Does it work? msbuild.exe mySolution.sln /t:Rebuild

Try settings target Rebuild

What user account is used to run build agent windows service?




回答2:


The problem was that the .sln file was repeated on the repository, on two different locations, and I configured the TeamCity to build the wrong one...



来源:https://stackoverflow.com/questions/2225468/why-does-teamcity-miss-a-reference-and-fails-compilation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!