Hey folks, another hopefully quick question.
I am successfully calling MSbuild from CC.NEt to build my solution. MSbuild
is building a version string that looks something like <hard code major
version>.<hard code minor version>.<build date>.<subversion revision number>
and writing it out to a shared AssemblyInfo.cs. I would like to use that
same version string as my build label. Can I pass this version string from
MSbuild back to CC.Net and use in a labeller block? Or, has the build
already been labeled by the time CC.Net get to the <tasks> block?
Alternatively, can I build that same string in CC.Net and pass it to
MSBuild?
I am also using NAnt. Perhaps the solution is to build this string in NAnt
and pass it back to CC.Net and use it as a the build label and pass it to
MSbuild to use in the AssemblyInfo. If this is a better solution, how do I
go about passing parameters from NAnt back to CC.Net?
Thanks for the help. I am new to CC.Net, NAnt and MSBuild. I have always
written shell scripts to do this. Figured I would try to catch up with the
rest of the world ;)
The CC.Net task to call MSbuild looks something like this:
<tasks>
<!-- ... -->
<msbuild>
<executable>c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory></workingDirectory>
<projectFile>.\Build\someProject.msbuild</projectFile>
<targets>Compile</targets>
<timeout>300</timeout>
<logger>C:\Program
Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
</tasks>
And, my MSbuild task to build the version looks something like this:
<Target Name="Version">
<Version BuildType="Automatic"
RevisionType="Automatic"
StartDate="01/01/2009"
Major="3" Minor="1">
<Output TaskParameter="Major" PropertyName="Major" />
<Output TaskParameter="Minor" PropertyName="Minor" />
</Version>
<Time Format="MMddy">
<Output TaskParameter="FormattedTime" PropertyName="buildDate"
/>
</Time>
<!-- MSBuild.Community.Tasks to get the svn revision -->
<SvnVersion LocalPath="." ToolPath="c:\program files\SlikSvn\bin">
<Output TaskParameter="Revision" PropertyName="Revision" />
</SvnVersion>
<AssemblyInfo CodeLanguage="CS"
OutputFile="..\SharedAssemblyLocation\AssemblyInfo.cs"
AssemblyCopyright="Some copyright"
AssemblyCompany="Some company string"
AssemblyVersion="$(Major).$(Minor).$(buildDate).$(Revision)"
AssemblyFileVersion="$(Major).$(Minor).$(buildDate).$(Revision)"/>
<Message Text="Version:
$(Major).$(Minor).$(buildDate).$(Revision)"/>
<!-- MSBuild.Community.Tasks to commit the change for others to see
-->
<SvnCommit Targets="..\SharedAssemblyLocation\AssemblyInfo.cs"
Username="<username>"
Password="<password?"
Message="Autocommit from build"/>
</Target>
Scott