Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build both Debug and Release for a TeamCity project

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?

like image 357
Jack Ukleja Avatar asked Mar 28 '11 12:03

Jack Ukleja


People also ask

How do I use custom build in TeamCity?

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.

What are Debug and Release build configurations?

A Debug configuration supports the debugging of an app, and a Release configuration builds a version of the app that can be deployed.

What is difference between Debug and Release build?

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.


2 Answers

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.

like image 179
bentsai Avatar answered Sep 27 '22 20:09

bentsai


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

like image 25
Adam Straughan Avatar answered Sep 27 '22 22:09

Adam Straughan