In my previous post I talk about how the MSBuild script loads the same project files that Visual Studio uses. This is accomplished by setting conditions to some of the PropertyGroups and setting up groups that don't have a condition to contain values that booth Visual Studio and CCNet Builds can use.
Since I am using CCNet to automate my builds, I know that one of the properties that CCNet will always send to MSBuild is $(CCNetLabel). So in property groups and Targets that only CCNet should use, I set a condition to check if that property is not empty. In the same regards, I also have property groups that check $(CCNetLabel) is empty. This allows me to set the $(OutputPath) that would be set by the CCNet MSBuild file. But since the MSBuild file isn't called by Visual Studio, I have to set it here.
[code language="xml"]
..\bin\$(Configuration)\
[/code]
Now if for my CCNet builds, I want to ensure every assembly generates an XML comments file. To do this I have a block similar to the following:
[code language="xml"]
$(OutputPath)$(AssemblyName).xml
[/code]
When CCNet build ccnetconfig, I want to make sure the version of the assemblies matches the actual build version. So to do this in the project files I have a Target like this:
[code language="xml"]
[/code]
The Target above will only generate the AssemblyInfo.cs file if CCNet is building the project.
Now while these are not the exact values that are used for ccnetconfig, they are close. By adding these conditional statements in the project files, I can continue to add new source files, resources, etc. using Visual Studio, and not have to modify an MSBuild file with any of the newly added files.
tags:
MSBuild,
CCNet,
CCNetConfig,
CruiseControl.NET