Using the MSBuild build task as part of a build makes building multiple solutions or projects really easy. Just set the project to a wildcarded path and off it goes.
However, what if you have several solution files or, as in this case, BizTalk Deployment Framework projects that you want to build – BUT – there is one that you don’t? There is no obvious way to handle this. Clicking the ellipses just gives you the option to pick a single file from your repository:
And the popup help isn’t very forthcoming either:
One option would be to have one MSBuild task for every .btdfproj file that you want to build. This would be fine if you only have a few – but what if there are 50, or a 100, and you want to build all but one of them? It’s not exactly manageable.
Fortunately, there is another way, but you have to go hunting for it.
First, you need to set the system.debug variable to true. This will give you a lot more debug information in your logs when the build runs.
From this, we can see our wildcard path being passed to Find-VstsFiles, which then outputs some IncludePatterns and ExcludePatterns.
Searching for Find-VstsFiles brings back this – which gives us some syntax for specifying exclusion paths.
Separate multiple patterns using ";". Escape actual ";" in the path by using ";;".
"?" indicates a wildcard that represents any single character within a path segment.
"*" indicates a wildcard that represents zero or more characters within a path segment.
"**" as the entire path segment indicates a recursive search.
"**" within a path segment indicates a recursive intersegment wildcard.
"+:" (can be omitted) indicates an include pattern.
"-:" indicates an exclude pattern.
So now we can manually update our Project field on the MSBuild task to explicitly exclude a project that we don’t want to build:
+:$(Build.SourcesDirectory)\Source\**\*.btdfproj;-:$(Build.SourcesDirectory)\Source\ExcludeThisFolder\Deployment\Deployment.btdfproj