Using msbuild (RTM) as the build tool for an automated build without using built-in targets

I decided that, because I am now building all my personal projects in .Net 2.0, I should try and use msbuild as an automated build tool instead of NAnt.
Requirements: Installation of .Net Framework 2.0 (RTM) SDK
For this example, my folder structure is as follows:
I created a batch file to automate the build process called build.bat and placed it in the root directory.
build.bat :
@echo off
%WINDIR%Microsoft.NETFrameworkv2.0.50727msbuild.exe Application.Targets


The dependent application has a reference to the First library.
The result of the build is to delete the RootBuild directory and all its contents (cleaning the build directory), recreate it, and then build the applications in the build directory.
<Project xmlns="">
    <Target Name="BuildAll" DependsOnTargets="CleanBuildDirectory;CreateBuildDirectory;BuildFirstDll;BuildDependentApplication" />
    <Target Name="CleanBuildDirectory">
        <Exec Command="rd /q /s $(BuildDirectory)" />
    <Target Name="CreateBuildDirectory">
     <MakeDir Directories="$(BuildDirectory)" />
     <First Include="$(SourceDirectory)$(SourceFirstDllDirectory)***.cs" />
    <Target Name="BuildFirstDll">
     <Csc Sources="@(First)" TargetType="library" OutputAssembly="$(BuildDirectory)First.dll" />
     <DependentApplication Include="$(SourceDirectory)$(SourceDependentApplicationDirectory)***.cs" />
    <Target Name="BuildDependentApplication" DependsOnTargets="BuildFirstDll">
     <Csc Sources="@(DependentApplication)" TargetType="library"
     OutputAssembly="$(BuildDirectory)Dependent.dll" />

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s