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 Stephany Whatcott on 13 de janeiro de 2017 - 1:56 pm

    Very good written post. It will be valuable to anybody who utilizes it, including myself. Keep doing what you are doing – i will definitely read more posts.

  2. #2 by free download for pc on 13 de janeiro de 2017 - 1:57 pm

    Every after inside a although we opt for blogs that we read. Listed beneath are the most current web pages that we pick

  3. #3 by Salvador Nowell on 13 de janeiro de 2017 - 2:11 pm

    Considerably, the post is in reality the finest on that laudable topic. I fit in with your conclusions and can eagerly look forward to your incoming updates. Saying thanks definitely will not simply just be enough, for the outstanding clarity in your writing. I will certainly at once grab your rss feed to stay privy of any kind of updates. Pleasant work and also much success in your business efforts!

  4. #4 by Pedi Couture on 13 de janeiro de 2017 - 2:52 pm

    have already been reading ur blog for a couple of days. really enjoy what you posted. btw i will be doing a report about this topic. do you happen to know any great websites or forums that I can find out more? thanks a lot.

  5. #5 by skechers uk on 13 de janeiro de 2017 - 5:58 pm

    Can I just say what a reduction to find somebody who truly knows what theyre speaking about on the internet. You positively know easy methods to carry an issue to gentle and make it important. Extra individuals must learn this and perceive this facet of the story. I cant believe youre no more fashionable because you definitely have the gift.

  6. #6 by jack rabbit vibrator on 13 de janeiro de 2017 - 8:26 pm

    below you will find the link to some web-sites that we believe it is best to visit

  7. #7 by jack rabbit on 13 de janeiro de 2017 - 9:48 pm

    just beneath, are a lot of absolutely not connected websites to ours, having said that, they are surely really worth going over

  8. #8 by michael kors outlet on 14 de janeiro de 2017 - 3:07 am

    There may be noticeably a bundle to know about this. I assume you made sure nice factors in options also.

  9. #9 by besuche unsere webseite on 14 de janeiro de 2017 - 3:23 am

    Dieses mal hat es mir der sexy Apfelarsch angetan, den ich hier http: fickkontakte.html gefunden habe.

  10. #10 by yeezy boost on 14 de janeiro de 2017 - 3:50 am

    I enjoy you because of all your valuable work on this web site. My aunt loves making time for research and it’s easy to see why. Most of us know all about the compelling form you present very useful tactics by means of the web site and as well as inspire participation from other people about this concept and my child is actually becoming educated a lot of things. Take pleasure in the rest of the year. You are conducting a remarkable job.

  11. #11 by Toby Boesel on 14 de janeiro de 2017 - 5:45 am

    viagra online

  12. #12 by Neal Glatter on 14 de janeiro de 2017 - 5:45 am

    perth web designers

  13. #13 by double penetrator cock ring on 14 de janeiro de 2017 - 7:11 am

    here are some hyperlinks to web-sites that we link to because we assume they may be really worth visiting

  14. #14 by bitcoin faucet on 14 de janeiro de 2017 - 7:57 am

    although web-sites we backlink to beneath are considerably not connected to ours, we feel they may be in fact really worth a go by, so possess a look

  15. #15 by besuche hier on 14 de janeiro de 2017 - 10:32 am

    Die schwule maenner nackt Ausweise vom Geheimdienst hatte bereits gesehen und wusste, dass es keinen Sinn hatte, irgendwie Widerspruch zu gehen.Du machst es dir aktfotos schwulen wohl immer noch gern selber, hörte ich ihn sagen und sah erst jetzt, dass Inka einem Sessel hockte.

  16. #16 by Eugenia Pelczar on 14 de janeiro de 2017 - 2:00 pm

    latin kevin hart

  17. #17 by недвижими имоти пловдив цени on 14 de janeiro de 2017 - 2:35 pm

    You made some decent points there. I looked on the internet for the issue and found most individuals will go along with with your website.

  18. #18 by cheap air jordan on 14 de janeiro de 2017 - 4:30 pm

    Can I just say what a aid to seek out somebody who actually knows what theyre speaking about on the internet. You undoubtedly know the best way to deliver a problem to gentle and make it important. More folks must learn this and understand this side of the story. I cant believe youre no more in style since you definitely have the gift.

  19. #19 by turquoise hats for weddings on 14 de janeiro de 2017 - 6:57 pm

    You have noted very interesting points! ps nice web site.

  20. #20 by free online dating on 14 de janeiro de 2017 - 7:11 pm

    just beneath, are several entirely not related web-sites to ours, on the other hand, they’re surely really worth going over

  21. #21 by canadian music on 14 de janeiro de 2017 - 10:14 pm

    just beneath, are various entirely not related sites to ours, on the other hand, they are surely worth going over

  22. #22 by yeezy boost 350 on 15 de janeiro de 2017 - 2:15 am

    Youre so cool! I dont suppose Ive learn anything like this before. So good to search out someone with some authentic ideas on this subject. realy thanks for starting this up. this website is something that’s needed on the internet, someone with a bit of originality. helpful job for bringing something new to the internet!

  23. #23 by Google on 15 de janeiro de 2017 - 2:33 am

    Always a big fan of linking to bloggers that I like but dont get a great deal of link like from.

  24. #24 by webcam models on 15 de janeiro de 2017 - 6:49 am

    please take a look at the internet sites we adhere to, including this one, because it represents our picks in the web

  25. #25 by web-link on 15 de janeiro de 2017 - 8:07 am

    Davon kannst du dir kein richtig gelebtes Leben mit Höhen und Tiefen und ganz vielen intensiven Erfahrungen kaufen.

  26. #26 by louboutin shoes on 15 de janeiro de 2017 - 4:03 pm

    Nice post. I study one thing more difficult on different blogs everyday. It’s going to always be stimulating to read content from other writers and practice a little bit one thing from their store. I抎 choose to make use of some with the content on my blog whether or not you don抰 mind. Natually I抣l give you a link in your internet blog. Thanks for sharing.

  27. #27 by women's clothing on 15 de janeiro de 2017 - 4:52 pm

    Great ¡V I should certainly pronounce, impressed with your site. I had no trouble navigating through all the tabs as well as related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or something, web site theme . a tones way for your client to communicate. Nice task..

  28. #28 by How to Meditate on 16 de janeiro de 2017 - 3:41 am

    very nice submit, i actually love this web site, carry on it

  29. #29 by chrome hearts on 16 de janeiro de 2017 - 3:53 am

    Spot on with this write-up, I truly suppose this web site needs far more consideration. I抣l most likely be again to read rather more, thanks for that info.

  30. #30 by Online Casino on 16 de janeiro de 2017 - 4:16 am

    Hi colleagues, how is all, and what you wish for to say on the topic of this paragraph, in my view its genuinely awesome for me.|

  31. #31 by beton imprime on 16 de janeiro de 2017 - 10:53 am

    Absolutely pent articles, thanks for entropy.

  32. #32 by GEICO insurance quotes online on 16 de janeiro de 2017 - 5:07 pm

    As a Newbie, I am constantly exploring online for articles that can benefit me. Thank you

  33. #33 by ratings for life insurance companies on 16 de janeiro de 2017 - 7:34 pm

    I like this post, enjoyed this one appreciate it for putting up. “He removes the greatest ornament of friendship, who takes away from it respect.” by Cicero.

  34. #34 by free download for windows pc on 16 de janeiro de 2017 - 11:43 pm

    It’s the best time to make some plans for the future and it’s time to be happy. I have read this post and if I could I desire to suggest you few interesting things or tips. Perhaps you could write next articles referring to this article. I want to read more things about it!

  35. #35 by Best Selling Vibrator on 17 de janeiro de 2017 - 1:39 am

    one of our guests recently suggested the following website

  36. #36 by how to anal on 17 de janeiro de 2017 - 2:35 am

    here are some links to sites that we link to mainly because we consider they are really worth visiting

  37. #37 by Health Clinic on 17 de janeiro de 2017 - 3:33 am

    I simply couldn’t leave your website before suggesting that I really loved the standard information a person supply in your guests? Is going to be back regularly to investigate cross-check new posts

  38. #38 by Pikachu Pokemon on 17 de janeiro de 2017 - 4:12 am

    Would you be interested by exchanging hyperlinks?

1 160 161 162
(não será publicado)