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 cheap christian louboutin on 25 de setembro de 2016 - 1:40 pm

    it comes within a beautiful box seems awesome although the somewhat little additionally towards my personal parents wrist however it seems ideal just really want information technology had been extended

  2. #2 by vergleichen on 25 de setembro de 2016 - 2:37 pm

    Just Browsing While I was surfing yesterday I saw a great post concerning

  3. #3 by lowest homeowners insurance rates in florida on 25 de setembro de 2016 - 3:26 pm

    Only a smiling visitor here to share the love (:, btw great pattern.

  4. #4 by why not try this out on 25 de setembro de 2016 - 4:12 pm

    You should participate in a contest for among the best blogs on the web. I’ll suggest this site!

  5. #5 by view on 25 de setembro de 2016 - 4:24 pm

    Pretty! This was an extremely wonderful post. Many thanks for supplying these details.

  6. #6 by Japanese Swords on 25 de setembro de 2016 - 4:47 pm

    Great transaction, great seller, Thanks! A++

  7. #7 by Fenster und Turen on 25 de setembro de 2016 - 5:20 pm

    very handful of internet sites that occur to become in depth beneath, from our point of view are undoubtedly properly really worth checking out

  8. #8 by corey crawford jersey on 25 de setembro de 2016 - 6:55 pm

    Dollars is also a important root of anxiety, only for the point that right now there never looks like it’s enough than me. Therefore, as the income keeps hanging out however in no way usually consist of adequate, anxiety just will keep hanging. Sad to say, partners, young children and frequently mom and dad can often help remind us individuals shortfalls and they will typically increase the emotional stress. Naturally , for example very little belonging to the repeated reminders with the mortgage or rent, vehicle installments, charge cards and various debts. Plus, on top of that, it is extremely to be able to always be philosophical around money pressure since planning to fit things towards perspective only recalls imagination around the bucks that usually appear to be missing. So, money stress basically keeps piling up higher and higher in addition to there under no circumstances is apparently a way to get rid of it.

  9. #9 by elephant insurance md on 25 de setembro de 2016 - 7:11 pm

    I am no longer certain where you are getting your information, however good topic. I needs to spend a while learning more or figuring out more. Thank you for magnificent info I used to be searching for this information for my mission.

  10. #10 by on 25 de setembro de 2016 - 7:38 pm

    Our headset had been like stunning because in the image. That it arrived quickly. I’d encourage using a towel above each coating as you press they out w / your steam iron. It does not vapor off along with only a steamer. All iron is needed. It is very sensitive, so if you you should not trust your self with the towel and/or vapor iron, next bring that it to a pro. Beautiful audio.

  11. #11 by true sword on 25 de setembro de 2016 - 9:27 pm

    Item exactly as decribed…Fast shipping. Will repeat business

  12. #12 by real swords on 25 de setembro de 2016 - 9:32 pm

    Beautiful handshoe! Fast ship and packaged well! Thanks!

  13. #13 by samurai katana sword on 25 de setembro de 2016 - 10:02 pm

    Love it!!!!!

  14. #14 by wakizhasi on 25 de setembro de 2016 - 10:03 pm

    Great Transaction. Worked hard to get it right. Thanks

  15. #15 by cartier love bracelet replica on 25 de setembro de 2016 - 10:04 pm

    it comes down within a beautiful package seems very good then again their somewhat smaller additionally of the parents wrist but it looks awesome exclusively want information technology was longer

  16. #16 by home insurance RANKING on 25 de setembro de 2016 - 10:44 pm

    great post.Never knew this, regards for letting me know.

  17. #17 by fortsetzen on 25 de setembro de 2016 - 11:12 pm

    und , ich bin auch der meinung, dass meine lebensqualität stark eingeschränkt ist.

  18. #18 by Donaldnen on 25 de setembro de 2016 - 11:21 pm

    gdcxfzw cheap jerseys [url=]wholesale jerseys from china[/url] qnnvmdz Jared Abbrederis Jersey tdmrljo >wholesale nfl jerseys wgpicfwcheap jerseys jarduca

  19. #20 by christian louboutin outlet store on 26 de setembro de 2016 - 3:54 am

  20. #22 by Heroes on 26 de setembro de 2016 - 4:20 am

    Thanks-a-mundo for the blog.Really looking forward to read more.

  21. #23 by on 26 de setembro de 2016 - 5:30 am

    Our headset ended up being just as breathtaking just as inside photo. This came immediately. I would suggest choosing a towel more than every one level while you hit that it off w / the best steam iron. It doesn’t steam off using merely a steamer. On iron had been essential. It is very delicate, when you don’t trust your self with all the towel and also steam iron, then bring it to a expert. Striking sound.

  22. #24 by on 26 de setembro de 2016 - 5:31 am

    It headset had been since stunning while inside photo. Things came promptly. I’d recommend using a towel above every layer as you press that it off w / a vapor iron. It doesn’t steam over among merely a steamer. That the iron had been necessary. It can be fine, so if you don’t trust personally with all the towel then vapor iron, subsequently bring that it up to a pro. Perfect seem.

  23. #25 by SATTA MATKA RESULT on 26 de setembro de 2016 - 6:31 am

    Wonderful story, reckoned we could combine several unrelated data, nonetheless actually really worth taking a search, whoa did one master about Mid East has got extra problerms at the same time

  24. #26 by more information on 26 de setembro de 2016 - 6:59 am

    Very good article. Great.

  25. #27 by necktie on 26 de setembro de 2016 - 7:06 am

    I like the efforts you have put in this, thankyou for all the great articles.

  26. #28 by on 26 de setembro de 2016 - 7:12 am

    it comes in a perfect container seems great however the a bit small additionally of my personal parents wrist however it appearance awesome just desire that is much longer

1 104 105 106
(não será publicado)