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 deko ideen schlafzimmer selber machen on 26 de agosto de 2016 - 4:25 pm

    I reckon something truly special in this web site.

  2. #2 by the blog on 26 de agosto de 2016 - 4:56 pm

    I’ll machines this evaluate in the direction of Two styles of people: current Zune house owners who are looking at an improve, and americans trying in direction of come to a decision between a Zune and an iPod. (There are other avid gamers worth looking at out there, like the Sony Walkman X, however I anticipate this delivers you adequate information in direction of crank out an conscious final decision of the Zune vs gamers other than the iPod line as well.)

  3. #3 by on 26 de agosto de 2016 - 7:18 pm

    it comes within a gorgeous box appearance awesome however their somewhat smaller and even concerning the parents wrist however it appearance ideal exclusively desire they is much longer

  4. #6 by on 27 de agosto de 2016 - 2:31 am

    Your headset was since beautiful since in the visualize. Things came immediately. I’d encourage using a towel during every single level as you push information technology out w / letter steam iron. It does not vapor off and only a steamer. All iron was appropriate. It can be fragile, when you do not trust your self using the towel furthermore vapor iron, well choose this up to a professional. Awesome audio.

  5. #7 by on 27 de agosto de 2016 - 2:31 am

    This particular headset had been while stunning as in the picture. Information technology appeared promptly. I’d recommend utilizing a towel done every single coating while you push information technology outside w / one steam iron. It doesn’t vapor over with merely a steamer. On iron ended up being needed. It is very fine, when you you should not trust yourself aided by the towel to vapor iron, after that choose that it up to a certified. Awesome seem.

  6. #8 by on 27 de agosto de 2016 - 2:41 am

    It is an awesome gift towards your very own loved ones. I’d strongly incourage people to go for your this makes a ideal gift. Your sender does a good time work in buying that products on time. I requested the stuff every day ago and I also reveived it really accelerated.

  7. #9 by on 27 de agosto de 2016 - 2:42 am

    It is an great gift of your very own family. I would strongly incourage people to purchase it it makes a great gift. That transmitter does a great time work in obtaining ones products on top of instant. I purchased our things every day back and I also reveived it certainly fast.

  8. #10 by creosote sweeping log smell on 27 de agosto de 2016 - 2:56 am

    certainly like your website but you need to check the spelling on quite a few of your posts. Many of them are rife with spelling issues and I in finding it very troublesome to inform the truth however I’ll certainly come back again.

  9. #11 by click on 27 de agosto de 2016 - 5:30 am

    Regards for this fantastic post, I am glad I found this website on yahoo.

  10. #12 by Broderick Aills on 27 de agosto de 2016 - 5:34 am

    tiffany co

  11. #13 by SATTA MATKA RESULT on 27 de agosto de 2016 - 5:52 am

    one of our guests lately encouraged the following website

  12. #14 by on 27 de agosto de 2016 - 8:45 am

    it comes in a breathtaking container appearance ideal but its slightly smaller actually for the the mothers wrist but it looks awesome simply desire it ended up being further

  13. #15 by on 27 de agosto de 2016 - 8:45 am

    I got your gift of my personal mom for the Christmas mainly because she is actually one jewelry freak. The something she cannot use a great deal regarding is actually, bracelets. I purchased this girl this one appeal bracelet additionally whenever she opened that yesterday she absolutley loved that it! This time the issue is, the lady getting that it on and off of with herself. Haha… general great product or service, this delivered as well as came quite very early to the mother is actually enjoying information technology. Thank your.

  14. #16 by on 27 de agosto de 2016 - 3:27 pm

    Recieved that product prior to the time given in a really great gift package . The actual visualize that is revealed for the bracelet are exactly what you certainly will recieve. That is really fragile but the best awesome section to precious jewelry which will endure considering iof ones toggle clasp and is quite solid so the bracelet eill never come off.

  15. #17 by cotton candy rental machine on 27 de agosto de 2016 - 3:40 pm

    I have always been just starting out and wish to get a blog page started..

  16. #18 by iklan baris on 27 de agosto de 2016 - 4:17 pm

    Blogspot blog: How do I get rounded sides for my backgrounds?

  17. #19 by Beschreibung on 27 de agosto de 2016 - 8:41 pm

    der Mutter verdorben oder ‘s Sexleben 2 Mit sechzehn Nach rund zwei Jahren, ich war inzwischen 16 Jahre alt geworden, hatte ich keinerlei Schwierigkeiten mehr, einen großen Di…..

  18. #20 by on 27 de agosto de 2016 - 8:52 pm

    I have that gifts to my mother for the Christmas simply because she is actually the best precious jewelry freak. That the something she does not don a great deal of is actually, bracelets. I purchased her this one charm bracelet and/or anytime she opened up this yesterday she absolutley adored things! Today the problem is, her acquiring this concerning plus off of simply by by herself. Haha… total great product or service, that shipped additionally arrived incredibly early and/or my personal mom are enjoying it. Thank one.

  19. #21 by on 28 de agosto de 2016 - 2:32 am

    Recieved our product prior to the time given in a very kind gifts package . That the visualize that’s presented for the bracelet is actually what you are going to recieve. This is most delicate yet a stunning piece out of jewelry that will endure due to the fact iof the particular toggle clasp that is quite robust so that the bracelet eill maybe not come off.

  20. #22 by on 28 de agosto de 2016 - 2:33 am

    It is an awesome gifts for your very own loved ones. I would strongly incourage people to invest it this will make a ideal present. All transmitter can a great evening task at getting that products concerning time. I bought our things each day back and I reveived it certainly fast.

  21. #23 by Gun Control on 28 de agosto de 2016 - 3:46 am

    This website is amazing. I will tell about it to my friends and anybody that could be interested in this subject. Great work guys!

  22. #24 by on 28 de agosto de 2016 - 4:19 am

    This particular headset ended up being just as beautiful because inside visualize. Information technology came immediately. I’d encourage using a towel through each coating as you push this away w / any vapor iron. It doesn’t steam away with only a steamer. On iron was necessary. It is very fragile, when you don’t trust your self aided by the towel additionally vapor iron, therefore take they up to a professional. Awesome sound.

  23. #25 by on 28 de agosto de 2016 - 4:20 am

    Our headset was like breathtaking because within the picture. Things appeared quickly. I would encourage utilizing a towel more than every single layer as you hit that it off w / one vapor iron. It doesn’t vapor off with merely a steamer. All iron ended up being needed. It can be sensitive, so if you you should not trust yourself with all the towel and steam iron, and then take things up to a pro. Pretty noise.

  24. #26 by Willy Vance on 28 de agosto de 2016 - 5:49 am

    I simply couldn’t go away your website prior to suggesting that I extremely loved the standard info a person supply in your visitors? Is going to be back regularly to check up on new posts

  25. #27 by on 28 de agosto de 2016 - 9:58 am

    I got this one gift to the mom concerning Xmas simply because she is your precious jewelry freak. The particular something she cannot wear much regarding is, bracelets. I bought her that charm bracelet additionally where she opened that it yesterday she absolutley liked things! Now the problem was, her buying that on plus down by just herself. Haha… in general great device, that transported and arrived completely very early as well as our mom is actually enjoying things. Thank your.

  26. #28 by on 28 de agosto de 2016 - 9:59 am

    I got this gift for the the mom of Christmas simply because she is actually one precious jewelry freak. Some sort of something she cannot don a lot to is actually, bracelets. I bought this girl the appeal bracelet as well as when she exposed information technology yesterday she absolutley loved that! Today the issue was, the lady getting things regarding to down by herself. Haha… general very good system, that transported and also appeared incredibly very early and also the mom are experiencing this. Thank people.

  27. #29 by on 28 de agosto de 2016 - 3:29 pm

    Recieved the item before the day presented in a very nice present container . The image that’s revealed for the bracelet is actually exactly what you are going to recieve. That is very delicate though a perfect piece regarding precious jewelry that will endure simply because iof some sort of toggle clasp and that is quite robust so the bracelet eill maybe not come off.

  28. #30 by buy levitra and viagra on 28 de agosto de 2016 - 4:35 pm

    I really liked your article post.Thanks Again. Awesome.

  29. #31 by bdomains on 28 de agosto de 2016 - 4:39 pm

    Utterly pent articles, Really enjoyed studying.

1 88 89 90
(não será publicado)