TeamCity 2018+TFS:如何检出根目录仅监控指定子目录变更?
Absolutely, you can achieve this exact setup with TeamCity 2018 and TFS—here's a step-by-step breakdown tailored to your needs:
Step 1: Configure VCS Triggers to Only React to ProjectA Changes
- Go to your build configuration's Triggers tab, edit your existing VCS Trigger (or add a new one if you don’t have one).
- Under Trigger Rules, add these two rules in order (TeamCity evaluates rules top to bottom, so order matters):
-:**(This rule excludes all paths by default, blocking triggers from changes anywhere else)+:**/Root/ProjectA/**(This re-includes only the ProjectA directory and all its subfolders/files, so only changes here will trigger a build)
Note: If "Root" is the root level of your TFS repository, you can simplify the path to
+:**/ProjectA/**.
Step 2: Ensure Full Root Directory Checkout
- Navigate to your build configuration's VCS Settings tab, and locate the Checkout Rules section for your TFS VCS Root.
- Verify the checkout rule is set to
+:.=>.—this tells TeamCity to checkout the entire root directory from TFS into your build agent's working directory. Avoid any rules that exclude ProjectB or other parts of the root, as that would break your requirement to run builds on the full Root.
Step 3: Filter Change Log to Only Show ProjectA Modifications
- Still in the VCS Settings tab, scroll down to the Change Log section and click Edit.
- In the Path Filters field, add
+:**/Root/ProjectA/**(adjust the path to match your actual TFS structure if needed). - This ensures that when you view the build’s change history or logs, only modifications within ProjectA are displayed—even though the full Root directory was checked out for the build.
Bonus Testing Tip
- Validate the setup by making a test change in ProjectB first: your build should not trigger. Then make a change in ProjectA—your build should trigger, and the change log will only show the ProjectA modification.
内容的提问来源于stack exchange,提问作者Mtq
相关产品推荐
相关产品推荐

