The first idea that comes to my mind is to use two Visual Studio (.sln) build steps - one for each configuration. (Multiple builds steps supports on TC v5+).
Is there a better way?
To run a custom build with specific changes, open the build results page, go to the Changes tab, expand the required change, click the Run build with this change, and proceed with the options in the Run Custom Build dialog. Use HTTP request or REST API request to TeamCity to trigger a build.
A Debug configuration supports the debugging of an app, and a Release configuration builds a version of the app that can be deployed.
Debug Mode: When we are developing the application. Release Mode: When we are going to production mode or deploying the application to the server. Debug Mode: The debug mode code is not optimized. Release Mode: The release mode code is optimized.
We have two separate MSBuild targets that build the solution using different properties:
<Target Name="Build-Debug">
<MSBuild Projects="OurSolution.sln" Targets="Rebuild" Properties="Configuration=Debug" />
</Target>
<Target Name="Build-Release">
<MSBuild Projects="OurSolution.sln" Targets="Rebuild" Properties="Configuration=Release" />
</Target>
From TeamCity, we have one "Configuration" (in TeamCity-speak) that calls the Build-Debug
target, and another that calls the Build-Release
.
We always wrap the sln build with an msbuild to add in running tests, building sql scripts, etc. At this point you could call out to the sln and set the appropriate property values; Configuration=Debug and Configuration=Release
Unless you are just trying to do release with pdb files (which is always a good idea) in which case just change the properties in the build section in Visual Studio
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With