Building System For Large C#/XNA Projects

This Post will talk about our custom Building System used to create the PloobsEngine MSI Package. Lots of time ago, when the engine code and the project number were smaller, we could afford to build our packages by hand, but when things got bigger and bigger the necessity for something fully automatizated became obvious.

The main funcionalities of our Building System are:

  1. Download Latest/Specific version of your repo (Mercurial)
  2. Compile all Projects, Tests and Demos
  3. Run Some Tests
  4. Compile Documentation
  5. Create and compress the Package (generate the Msi file)
  6. Upload to a Server (ftp)
  7. Notify People (send emails)

Here we will describe with details how each part was implemented, showing some parts of the used scripts.  (Everything is hosted in a Windows 7 machine).

Download Latest/Specific version of your repo.
As said, We used Mercurial for source code management. To download the repo and update to the latest version we used the following script.

@echo off
echo Downloading Ploobs HG Repo
cd /
if exist %RepoPath%/port-ploobsengine   goto NEXT
md %RepoPath%\
cd %RepoPath%\
call hg clone
if %errorlevel% 1 (
   echo Failure Reason Given is %errorlevel%
   chdir /d %OLDDIR%
   exit /b %errorlevel%
cd /

cd %RepoPath%port-ploobsengine
call hg pull
call hg update --clean
cd /

The script is very simple, it just creates the repo folder and clone the repo (if it does not exists yet) and then pull and updates its contents to the latest remote version. (the bin folder of the TortoiseHg must be on the Windows Path. If you use SVN or git or …. just adapt the script).

To those that are curious, our public repo is:

Compile all Projects, Tests and Demos
We have lots of different types of projects in PloobsEngine, then we need to use different tools to build each of them. The following script shows how to deal with these situations:
First of all: Set some Environment Variables (MSBuild Path, XNA PATH, .Net Framework Path …)

SET PATH=%*;%XNAGSv4%Tools;%XNAGSShared%XnaPack;%XNAGSShared%Device Center;C:\Windows\Microsoft.NET\Framework\v4.0.30319\;C:\Windows\Microsoft.NET\Framework\v3.5\;C:\Windows\Microsoft.NET\Framework\v2.0.50727;%PATH%

Using Msbuild for content pipeline and main XNA project

The content pipeline / XNA project are just “regular” Visual Studio projects, to build them we just used the following lines (adapt to your needs)

msbuild %RepoPath%\PloobsEngine\PloobsEngineContent\PloobsEngineContent.contentproj /p:XNAContentPipelineTargetPlatform=Windows;XNAContentPipelineTargetProfile=HiDef;TargetFrameworkVersion=v4.0;Configuration=Release
msbuild %RepoPath%\PloobsEngine\PloobsEngine\PloobsEngine.csproj /p:Configuration=Release

Using the Visual Studion IDE compiling ability directely (msbuild cant compile Visual Studio Installer projects !!!)

Some projects (like those that ends with .vdproj) cant be built using MSBuild, then we call directely the Visual studio line comand IDE utility.

echo Compiling Ploobs Updater
"%VS100COMNTOOLS%..\IDE\" /build Release %RepoPath%\PROJEC_PATH\PloobsInstallerSetup.vdproj
rd /s/q FOLDER
copy %RepoPath%\PROJECT_PATH\*.* FOLDER /Y

Just building and copying the generated contents to a folder (deleting if it already exists)

Using Msbuild to Compile/Clean Full Solutions

The script:

echo Copy Others Demos
rd /s/q SourceCodeDemos
md SourceCodeDemos
msbuild %RepoPath%\PloobsUpdater\PloobsUpdater.sln
msbuild %RepoPath%\AdvancedDemos\AdvancedDemos.sln /t:Clean
msbuild %RepoPath%\IntroductionDemo\IntroductionDemo4.0\IntroductionDemo4.0.sln /t:Clean
msbuild %RepoPath%\ReachDemos\ReachDemos.sln /t:Clean
msbuild %RepoPath%\PhoneSilverLightDemo\GraphicsApp1.sln /t:Clean

Just building the PloobsUpdater.sln Solution and cleaning some others (removing the Bin and Obj folders -> removing previous builds contents, we dont need to send then to the clients !)

Calling Some Custom Scripts

PloobsEngine depends of LOOTS of Dlls, for the end user is easier to have just one with everything inside of it, the following code shows how this can be achieved (using the Microsoft ILMerge Program)

ilmerge /out:PloobsEngineDebug.dll SharedOsiris.dll PloobsEngine.dll FarseerPhysicsXNA.dll Lidgren.Network.dll Library.dll TomShane.Neoforce.Controls.dll BEPUphysics.dll XNAnimation.dll DPSF.dll  /lib:"C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86" /targetplatform:v4,"C:\Windows\Microsoft.NET\Framework\v4.0.30319" /keyfile:XNAnimation.snk  /xmldocs  /ver: /log

For more informations about the arguments, look at the ILMerge Documentation. In this line we just merged Lots of dlls (and the xml docs of each one) and signed the generated assembly with a keyfile.

Running Some Tests

To make sure that we are delivering something that works, our building system also implements some custom unity and Visual Tests. The following script calls our Test Module and checks its answer. (if somethings wrong happens, errors are directed to us !)

echo Executing Visual Tests
cd AdvDemosBin
call AdvancedDemos.exe VisualUnitTests
echo Return Code is %errorlevel%
if %errorlevel% == 0 goto LB
   echo Tests Failed, Check the Logs
   set erro=1 #### Pack the logs and mail the programmers =P ....
   exit /b -1
del *.log
cd ..

Compiling the Documentation
We use the marvelous SandCastle project to create our documentation.
Sandcastle produces accurate, MSDN style, comprehensive documentation by reflecting over the source assemblies and optionally integrating XML Documentation Comments. It also let us to create some custom pages in order to make a full professional like manual.
The amazing thing is that SandCastle compilation can be triggered using msbuild. (the output is a .chm file), the following script shows how:

if %NODOC% == "FALSE"  goto ND
echo Compiling Ploobs Documentation
msbuild %RepoPath%\Documentation\EngineHelper.shfbproj
rd /s/q Help
md Help
copy "%RepoPath%\Documentation\Ploobs Engine Help.chm" Help /Y

Creating the Installer (using the marvelous InstallShield Visual Studio Extension)

Each piece are put together with the Install Shield Installer (ends up up a MSI package). The building process can also be triggered using msbuild !!!

echo Creating the Installer
rd /s/q PloobsEngine
md PloobsEngine
rd /s/q %RepoPath%\PloobsInstaller\PloobsInstaller\Express
msbuild %RepoPath%\PloobsInstaller\PloobsInstaller.isproj /p:Configuration=Release;Build=Complete;BuildCompressed=true;BuildSetupExe=true
xcopy %RepoPath%\PloobsInstaller\PloobsInstaller\Express\Release\DiskImages\DISK1\*.*  PloobsEngine /Y /e /i /h

We also run some custom scripts to set the right minor/minor version of the release.

Compressing with Rar (using the classic Winrar)

After the package generation, we need to compress it to a single file (not a requirement in most cases). We just used the classic Winrar for this task.

set PATH="C:\Program Files (x86)\WinRAR";%PATH%
cd PloobsEngine
rd /s/q Package
md Package
cd ..
rar a -r "PloobsEngine/Package/PloobsEngine.rar" "PloobsEngine/*"
copy %DeployPath%\Changes.pdf %DeployPath%\PloobsEngine\Package\ /Y

Uploading to FTP server (generated from the previous pass)

Then we make a simple script to connect to our FTP server to upload the rar file to the righ folder

@echo off
echo Uploading Installer to the Main Server
echo user USER> ftpcmd.dat
echo PASSWORD>> ftpcmd.dat
echo cd Web/Updater>> ftpcmd.dat
echo mkdir teste>> ftpcmd.dat
echo cd teste>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo mput piece.bat>> ftpcmd.dat
echo y>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat FTP_URL
del ftpcmd.dat

The script just generates a dummy conf file (to be able to log in the remote ftp server) and uses it as a parameter to the FTP command.

You can download our packages here:

Sending some Emails and notifications

The last step is notifying everyone involved about the new release. For this we just send some email to the righ people (We made a custom .exe to perform this task, unfortunaly the code is not avaliable but this is a very simple thing to build)

We also have some things to adjust the version number of the releases that were not shown here.

The whole proccess takes more than 4 hours to be completed and is fully automatized. (We remotely calls it and waits for the email containing the Download Link !!!)

There are lots of good build systems avaliable like Team City. I always encourage people to use them. Exceptionaly in our case, i prefered to do all by hand because of the large amount of customization we needed.

  1. #1 by Adalberto Gallinger on 8 de dezembro de 2016 - 6:08 am

    The next time I learn a weblog, I hope that it doesnt disappoint me as a lot as this one. I imply, I do know it was my option to read, but I really thought youd have something attention-grabbing to say. All I hear is a bunch of whining about one thing that you possibly can repair in the event you werent too busy looking for attention.

  2. #2 by on 8 de dezembro de 2016 - 7:05 am

    But not since fancy in real world when mothers wrist is actually never 2small dont get this influence this get tight .. their sweet although one thing yur 5year old makes . No that the reduced it is a okay gifts and provide yet not a wow present…cant get wrong in case do not need a great deal to spend for a gift subsequently see that it

  3. #3 by home on 8 de dezembro de 2016 - 8:49 am


  4. #4 by Google on 8 de dezembro de 2016 - 9:56 am

    That is the end of this report. Right here youll uncover some web-sites that we feel youll value, just click the links.

  5. #5 by Bale on 8 de dezembro de 2016 - 10:12 am

    Here is a good Blog You may Come across Intriguing that we Encourage You

  6. #6 by Cyrus Birkland on 8 de dezembro de 2016 - 1:05 pm

    cleaning supplies should have earth friendly organic ingredients so that they do not harm the environment;;

  7. #7 by Ich liebte diese on 8 de dezembro de 2016 - 2:44 pm

    Nadin hat eine Vorliebe für Gemüse.

  8. #8 by jordan release dates on 8 de dezembro de 2016 - 5:32 pm

  9. #9 by cheap mlb jerseys on 8 de dezembro de 2016 - 6:36 pm

    I precisely had to appreciate you once more. I’m not certain the things that I might have done without the type of hints provided by you on such a question. This has been a fearsome crisis in my view, however , spending time with a new expert technique you managed that took me to leap over fulfillment. I am happy for the help and in addition sincerely hope you really know what an amazing job you are always accomplishing training many others by way of your website. I am certain you’ve never encountered all of us.

  10. #10 by ルイ ヴィトン 店舗 神奈川 on 8 de dezembro de 2016 - 7:36 pm

    ルイヴィトン、シャネル、グッチ、エルメス、クロエ、プラダ、 ブルガリ、ロレックス、カルティエ 、オメガ偽物(コピー商品)のブランドのバッグ、財布、腕時計の販売、通販。
    グッチスーパーコピー,グッチ偽物バッグ,グッチ バッグ コピー,グッチ 新作
    ルイ ヴィトン 店舗 神奈川

  11. #11 by Las Vegas escort on 8 de dezembro de 2016 - 8:06 pm

    We’re a bunch of volunteers and starting a brand new scheme in our community. Your web site provided us with valuable information to work on. You’ve done a formidable task and our whole group shall be thankful to you.|

  12. #12 by free download for windows 8 on 8 de dezembro de 2016 - 9:36 pm

    Here are a number of the websites we suggest for our visitors

  13. #13 by Pips Wizard Pro Review on 8 de dezembro de 2016 - 10:14 pm

    always a huge fan of linking to bloggers that I enjoy but dont get a good deal of link like from

  14. #14 by air jordan 11 space jam on 8 de dezembro de 2016 - 10:40 pm

  15. #15 by home on 8 de dezembro de 2016 - 11:35 pm


  16. #16 by home on 9 de dezembro de 2016 - 2:39 am


  17. #17 by cartier love bracelet replica on 9 de dezembro de 2016 - 6:01 am

    But not like fancy in real life whether moms wrist was not 2small dont pick this result things stay tight .. it is attractive however some thing yur 5year aged makes . Non that the lower the one okay present towards award yet not per wow gifts…cant get wrong whether do not get much to spend for a gift then attain it

  18. #18 by on 9 de dezembro de 2016 - 6:01 am

    Bought that as a present of my mom furthermore she loved that. terrific grade awesome pricing furthermore our mother liked that it. Additionally sent super quick. So if you need a gift quickly while like this compared to here is the an you ought to buy!

  19. #19 by Adidas Originals NMD X Ultra Boost Mens Running Shoes Blue Fluorescent Green on 9 de dezembro de 2016 - 6:39 am

    There’s noticeably a bundle to learn about this. I assume you made certain nice points in options also.

  20. #20 by pc games for laptop on 9 de dezembro de 2016 - 7:03 am

    just beneath, are many completely not connected internet sites to ours, nonetheless, they may be surely really worth going over

  21. #21 by longchamps on 9 de dezembro de 2016 - 7:52 am

    I precisely needed to say thanks again. I do not know the things that I might have gone through without those information revealed by you on this topic. It seemed to be an absolute terrifying setting in my view, nevertheless encountering the very specialized way you solved that forced me to weep with fulfillment. Now i’m happy for this assistance and as well , expect you really know what an amazing job you are always undertaking educating the rest by way of a web site. I am sure you’ve never come across all of us.

  22. #22 by Cleotilde Schwarten on 9 de dezembro de 2016 - 10:01 am

    I savour, cause I discovered exactly what I used to be taking a look for. You’ve ended my four day lengthy hunt! God Bless you man. Have a nice day. Bye

  23. #23 by Rossana Serano on 9 de dezembro de 2016 - 10:12 am

    Bless you for this data I has been hunting all Yahoo in order to discover it!

  24. #24 by Entdecke mehr on 9 de dezembro de 2016 - 10:25 am

    Ich mußte die junge Verkäuferin aus dem Dessousladen denken, die immer noch den Keuschheitsgürten trug.

  25. #25 by Square One Condos on 9 de dezembro de 2016 - 10:49 am

    I am very happy to read this. This is the kind of manual that needs to be given and not the random misinformation that’s at the other blogs. Appreciate your sharing this best doc.

  26. #26 by Christopher Rubano on 9 de dezembro de 2016 - 12:56 pm

    And Im running from a standard users account with strict limitations, which I think may be the limiting factor, but Im running the cmd as the system I am currently working on.

  27. #27 by flexible vibrator on 9 de dezembro de 2016 - 2:37 pm

    below youll uncover the link to some websites that we consider it is best to visit

  28. #28 by snapchat for pc on 9 de dezembro de 2016 - 2:59 pm

    I do accept as true with all the ideas you’ve presented for your post. They’re very convincing and will definitely work. Still, the posts are too quick for newbies. May you please prolong them a little from subsequent time? Thanks for the post.

  29. #29 by Maximo Immen on 9 de dezembro de 2016 - 4:20 pm

    I’m gratified with the way that handles this type of subject. Generally to the point, often contentious, without fail well-written and thought-provoking.

  30. #30 by cosmetic dentist lewisville on 9 de dezembro de 2016 - 5:26 pm

    Hello to every body, it’s my first visit of this webpage; this webpage consists of remarkable and genuinely fine material designed for visitors.|

  31. #31 by Hermes Bracelet Replica on 9 de dezembro de 2016 - 5:31 pm

    Purchased our as being a gifts concerning the mama plus she liked that. sweet quality awesome amount then our mom enjoyed it. Also delivered ultra accelerated. So if you need a gifts quick while such as this then this is actually the a single make sure you purchase!

  32. #32 by Mirna Keffer on 9 de dezembro de 2016 - 5:44 pm

    12/9/2016 Appreciate this site– very user-friendly and much to consider!

  33. #34 by home on 9 de dezembro de 2016 - 10:58 pm


  34. #35 by moving company pods on 9 de dezembro de 2016 - 11:47 pm

    usually posts some quite interesting stuff like this. If youre new to this site

  35. #36 by on 10 de dezembro de 2016 - 3:03 am

    Bought it as a gift to my mother and/or she loved information technology. terrific grade good cost and also my mother loved they. Even delivered ultra quickly. When you need a present fast while like this than here is the one particular you need to pick!

1 146 147 148
(não será publicado)