Spacely BetaBlogger and MSBuild

by john 3/4/2007 6:26:00 AM

[Codegear] have very kindly given me permission to discuss Spacely, the upcoming release of [Delphi2007]. What better way to launch my blog than describe one of the new features.

[Delphi2007] is going to be using msbuild, which is a new build platform from Microsoft that comes as part of dotnet 2.0.

Documentation can be found here

http://msdn2.microsoft.com/en-us/library/wea2sca5.aspx 

I think this is a pretty exciting move, because not only can I do more during the build process right out of the box, but there also seems to be quite a community building around msbuild.

For example I found this website

 http://msbuildtasks.tigris.org/

They provide a number of additional build tasks that I hope to be able to leverage when building my Delphi projects.

The steps to add a build task are as follow:-

1) Create a file containing the task definition. This one just zips up the contents of the project directory

 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<ItemGroup>
<DefaultExclude Include="**\*.zip" />
<DefaultExclude Include="**\*.txt" />
<DefaultExclude Include="**\*.dpr" />
<DefaultExclude Include="**\*.dproj" />
<DefaultExclude Include="**\*.dproj.local" />
<DefaultExclude Include="**\*.identcache" />
<DefaultExclude Include="**\*.res" />
<DefaultExclude Include="**\*.dcu" />
<DefaultExclude Include="**\*.pas" />
<DefaultExclude Include="**\*.dfm" />
</ItemGroup>

<ItemGroup>
<ZipFiles Include="**\*.*" Exclude="@(DefaultExclude)" />
</ItemGroup>

<Target Name="Zip">
<Zip Files="@(ZipFiles)" ZipFileName="mosh.zip" />
</Target>
</Project>

2) I named this file extra.proj

3) Open up the Delphi project file and insert the following line just after the project tag

  <Import Project="extra.proj" />

4)  From the commandline, I can build the application and perform the additional task using

msbuild BuildThis.dproj /t:build,zip 

Just in case your wondering, dproj is the new file extension for Delphi project files.

Next step is to actually start reading the msbuild documentation :)

 

 Update:-


 It's possible to set the default target(s) inside the dproj file. So the first few lines now looks like

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="build;zip">
  <Import Project="extra.proj" />
  <PropertyGroup>

 

Notice the InitialTargets attribute

I am now able to run the zip task as part of an IDE build. 

MSBuild
 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

msbuild | Betablogger | Delphi | CodeGear | Spacely

Powered by BlogEngine.NET 1.3.0.0
Theme by Mads Kristensen

About the author

Name of author John Moshakis
I'm a software developer living in Toronto..

E-mail me Send mail

Calendar

<<  August 2020  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Authors

    Tags

    Don't show

      Disclaimer

      The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

      © Copyright 2020

      Sign in