How to configure TeamCity to build a solution with 2 projects?

独自空忆成欢 提交于 2019-12-11 01:24:30

问题


How to configure TeamCity to build a solution with 2 projects?

I have configured TeamCity to build my solution which has 1 project which is chosen as Startup Project and it builds fine.

I configured it by adding a new Build Step with Runner Type of "Visual Studio (sln)" from its WebUI.

I added a new class library project and added a reference to it from the first project and it builds fine locally.

The .csproj file of the first project now contains this:

 <ItemGroup>
    <ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj">
      <Project>{00E69E26-2576-4B9A-9180-CB1877B1D951}</Project>
      <Name>ClassLibrary1</Name>
    </ProjectReference>
  </ItemGroup>

I checked in the code and teamcity fails to build!

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

TeamCity seems to only build the startup project not the ClassLibrary1 although it's referenced.

How could I configure it to build my solution?

Would this be possible using the WebUI or I should be writing e.g. MSBuild scripts?

Thanks,


回答1:


Actually, the problem was TeamCity was caching because and the solution was to check the below check box from the Version Control Settings:

Agent checkout: Enforce overwrite all files

The reason it was caching was that I'm using the Checkout mode of "Automatically on server" which means it will cache: http://confluence.jetbrains.net/display/TCD65/VCS+Checkout+Mode




回答2:


Team City handles .sln files, so you should not have any problems with mutliple projects. Make Team City build the .sln files, not a csproj.

If it's already ok, check your reference to see if it points to the project within the solution or if it refers to the assembly file (might cause problem if you change your build configuration for example)

Your reference should look like this

<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj">
      <Project>{some guid identifying your project}</Project>
      <Name>ClassLibrary1</Name>
    </ProjectReference>

To have this result, the reference should be made by right clicking a project on solution explorer, choose add reference and go to the Project section



来源:https://stackoverflow.com/questions/9079666/how-to-configure-teamcity-to-build-a-solution-with-2-projects

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