CruiseControl.NET: Building a project in Debug and Release configurations - continuous-integration

I am using CruiseControl.NET to build a C# project. I am using an msbuild task to achieve this. I want to build the project in both Debug and Release mode irrespective of whether either mode fails. But If I put these as two msbuild tasks in the 'tasks' section of the project and if the first task fails, the second is not executed.
I could define them as two projects, but I want the Label to be synchronized across both the projects. Is there a way to do this?
One solution I have is make the 'Release' config project to trigger a build whenever the 'Debug' config project is built. But in that case, If someone force builds the 'Debug' config project then, the labels will get out of sync.

To achieve what you want, I think you will have to use a custom task to call MSBUILD from a CMD file and pass the debug/release mode into MSBUILD via cmd line args.

Use multiple tasks for the project.
Note: See CC.NET preprocessor if you want to reduce tags duplication.

Related

Ask TFS Build Server to not run Code Analysis on specific project

In our project we now have Code Analysis (CA) set per project and this is propagated to the TFS build server. But we would like not to run CA when we build locally, only on the build server.
The thing is, we have one project (SP 2013) which doesn't produce a DLL and this causes CA errors:
- CA0052 No targets were selected
- Could not load file .... App.dll
We could supress these, but I would like to have CA skip this project on the build server. Is this at all possible?
You could depending on how you do your configurations, only set code analysis to run on 'Release' Configuration. then set the one project so that the 'Release' configuration doesn't run CA. this way your devs can build under 'debug' with No CA and the TFS builds run under 'Release' with AsConfigured
if you are using UpgradeTempalate, you can pass the RunCodeAnalysis=Never as a property to your SolutionToBuld itemgroup. Something like below
RunCodeAnalysis=Never
If you are using default template, you can update it to pass it for the specific solution.
I take it that you want to still run Code Analysis on build outside Team build. If not, the better solution would be to not set the "Enabled Code Analysis on Build" flag.

How to create Target that always runs at the end of a build

I've got a vxcproj with configuration type Driver and am trying to edit the project file to add a custom target that will always run at the end of building the project. I want it to run even if the standard build system detects it doesn't need to build anything.
I'm having a hard time trying to work out where to attach my target. If I attach to AfterBuild or PostBuildEvent, my target won't run if there's nothing to build.
If you're interested, I need this target to run run StampInf and Inf2Cat tasks as the built in versions of those don't suit my purposes. The built in ones always run and dirty outputs, causing knock on rebuilding which I don't want in an incremental build.
Add a project of type General + Makefile. VS cannot optimize the build for these type of projects, the custom Build Command Line setting you specify always runs. You'll typically need to set the project dependencies to ensure it runs last.

Team City - build runner on static sites

I was wondering if someone would be able to explain what Build runners do and also what i would need to use for just a static HTML / CSS / JS site, or even an already compiled .NET site.
I will be hooking up each project to its equiv SVN and grabbing updates from there, but not 100% sure what the build runners do or which i should use as technically i dont need to build the site.
Sorry it may be too much to answer but i am just struggling to get my head round Team City
Thank you
Build runners are just a process for a specific task, for example the MSBuild runner is set up by putting information into specific fields which it then uses to call MSBuild on the target build agent. You could just as easily use the Command Line runner and build up the MSBuild run command manually.
Build runner is a part of TeamCity that allows integration with a
specific build tool (Ant, MSBuild, Command line, etc.). In a build
configuration, the build runner defines how to run a build and report
its results. Each build runner has two parts:
server-side settings that are configured through the web UI
agent-side part that executes a build on agent
You need to choose your runner depending on the task that you want to do and the technology that you have wrapped your project in. If there is no runner for your specific task then you can use the lowest common denominator which would be the Command Line runner.
The way I approach this would be to see how I can achieve what I want to from my own environment be that calling a rake, MSBuild or batch file. I then see how I can then apply that to a tool. Do not create a process around a tool but choose a tool that fits to your process.

Build project with multiple target

I have a project, which is actually build on Win32/.Net4.0 (VS2012).
Now I need to build this project also to x64/.Net4.0, as well as Win32/3.5 and x64/3.5.
I know it's possible with 4 projects, and build every project each time.But the code is always the same, so I want to know if it possible to have one project, which is build on every target on one build process?
Thanks kooki
You can invoke msbuild multiple times against the same project/solution to cover all your required configurations. Just pass the configuration via the command line. So, for a Release configuration for x86:
msbuild MySolution.sln /p:Configuration=Release /p:Platform=x86
You can then add a second call for another target platform.

Best practice to integrate custom build tasks in Visual Studio 2008 Project/Solution

To increase the automated part of our build/release process, I would like to integrate some custom tasks in our visual studio projects. What's the best way to organize such solutions? The main problem is: If I add the project implementing the tasks to the solution, the tasks are cached by the visual studio instance. So a rebuild does not work, because the output assemblies of the task project cannot be overwritten.
I can put the task in a separate solution. Seems to be the best (only?) option, but I don't like to maintain two solutions. This makes continous integration more complicated.
Any hints? How do you manage solutions having project specific custom build tasks?
If the custom build tasks refer to some documents included in the solution, then you can make a custom build rules document, refer it in your solution and specify the custom build name for each document in the properties (this will spare you on writing command, dependencies and everything for each document, if the rule is specified correctly using the macros like $(InputPath), etc.)
If the custom build tasks refer to some operations that are not related to documents in solution, you can have them specified as commands in the post build event of the project in the solution that needs it. Another alternative can be to add a new, dummy project in the solution that will have only this post build event, dependent on all the other projects (so the post build tasks will be called only after all the other projects were built).

Resources