Trigger TeamCity build when committing to a referred project
I have a .NET Solution with 3 Projects and the following references:
SOLUTION1
PROJECT1
reference project2
reference log4net
PROJECT2
PROJECT3
I understand that I can define VCS triggers to have a Solution build on a commit. Is there a way to define a build plan for Project1 where Project1 builds if there is a commit on any of its references? ie. if there is commit to Project1 or Project2, I'd want the Project 1 build plan to build but not when committing to Project3 since it is not referred to.
If this is possible, do you have to define the dependencies manually or can TeamCity detect all of the Project dependencies in a Solution?
Thanks.
Please sign in to leave a comment.
I'm trying to understand if building a project when a referred project has a check in is default behavior for team city? Is it aware of dependencies the way Visual Studio is? There are other CI tools where you have to manage the dependencies manually I am trying to determine if this is the case here or not. Thanks.
Hi,
this is going to depend on your setup. If you have everything in a single VCS root, whether you compile everything from within a single build configuration or compile it in different build configurations that have dependencies between them, etc.
Triggers are not aware of the "solution" structure, but triggers can be configured to trigger when only some branches, or paths have changes. Configuring TeamCity to work that way will require handling the different cases manually, once it's configured it can probably do it automatically.
Given that it seems that your solution can be compiled independently for each project, it would make sense to create a build configuration per project, then add a dependency from 1 to 2, then create separate triggers for each project.
Hope this helps.
Hi Denis,
It sounds like setting up the system of triggers to fire a build when a dependency changes will require manually maintaining a dependency tree. It might get tricky if after a lot of configuration, a new project is added to the solution where we need to insert into the middle of the dependency tree. Anyways thanks for the information, it seems like it can be done with this manual configuration.
Thank you for the help.
Hi,
I can only recommend giving it a try. We've had similar requests in the past that, after configuring it, realized it wasn't that bad. You don't have to manually handle dependencies other than when they're changed, which shouldn't happen all that often and is still a couple clicks away.
Our issue tracker is open for requests or suggestions, if you think any of this areas can be improved: https://youtrack.jetbrains.com/issues/TW