Restructured Repo, Lookup same SLN in different path

Completed

Hello,

we previously had another Repository Layout:
\Team\Build\Suite.SLN

After running into an annoying Android Build bug (https://developercommunity.visualstudio.com/content/problem/531456/android-debugging-wont-start-says-needs-to-be-depl.html), we moved all our solutions to the top-level git folder. Moving the SLN to the top folder allowed us to unify the R# DotSettings.
But in TeamCity, we still have to support old release branches. Can we use the same Build Config and search for the Solution File?
Another idea would be to have a parameter that has Path1 or Path2, depending on if the current branch contains the "merge" commit from the new SLN.

Best regards,

Christoph

0
1 comment

Hi. You can get the parameter value changed automatically based on a condition, as explained in this StackOverflow topic:

Add an extra parameter for the value you want to be conditional e.g., sln.path=%sln.path%. Then add a PowerShell build step at the start of your process, and enter a script like this:

$BuildBranch = "%teamcity.build.branch%"
$SNLPath = ""

if ($BuildBranch -eq "old-release-branch") {
$SNLPath = "Folder\Solution.sln"
}
else {
$SNLPath = "Solution.sln"
}
echo "##teamcity[setParameter name='sln.path' value='$SNLPath']"

The final line is the magic. By outputting that, teamcity will set your sln.path parameter. You can then use the parameter in subsequent build steps.

0

Please sign in to leave a comment.