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.

set RepoPath=c:/PATH_WHERE_WE_WILL_DOWNLOAD_OUR_REPO
@echo off
echo Downloading Ploobs HG Repo
cd /
if exist %RepoPath%/port-ploobsengine   goto NEXT
md %RepoPath%\
cd %RepoPath%\
call hg clone https://thiagodiaspastor@code.google.com/p/port-ploobsengine/
if %errorlevel% 1 (
   echo Failure Reason Given is %errorlevel%
   chdir /d %OLDDIR%
   exit /b %errorlevel%
)
cd /
:NEXT

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: http://code.google.com/p/port-ploobsengine/

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\devenv.com" /build Release %RepoPath%\PROJEC_PATH\PloobsInstallerSetup.vdproj
rd /s/q FOLDER
md 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:0.0.0.1 /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
:LB
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
:ND

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: http://www.ploobs.com.br/Updater/0.4.4/PloobsEngine.rar

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 http://www.takstogtegning.no/userfiles/Folder/79.html on 23 de julho de 2016 - 8:22 pm

    I acquired this particular searching for a great gifts to the mom. The actual headphone emerged within a perfect purple tied up container. This was the greatest looking gifts underneath their christmas tree!! The actual headphone in addition looked pretty, but my mama is actually big boned as well as the headphone are a little tight, still it is a great gifts! I really like it.

  2. #2 by Markita Fabroquez on 23 de julho de 2016 - 8:26 pm

    acne quistico

  3. #3 by Eliz Kreitz on 23 de julho de 2016 - 9:17 pm

    Someone necessarily help to make seriously posts I might state. That is the first time I frequented your website page and so far? I amazed with the research you made to create this particular publish amazing. Magnificent process!

  4. #4 by Nina Sheehy on 23 de julho de 2016 - 10:59 pm

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four e-mails with the same comment. Is there any way you can remove people from that service? Thanks a lot!

  5. #5 by http://getbeautysecrets.com/wp-includes/muvek-main.php on 23 de julho de 2016 - 11:10 pm

    in such an on-line video, involving us burning fat draw a anime turtle. start with getting a circle having two significant groups after only it due to vision along with a run. Next, maintain a good guitar’s neck which turtle leading into a nice disguise. operating from home is awesome for those of us who like the freedom to your workplace especially when. what i’m every hour owl. convinced inputting this valuable basically,just exactly times night.

  6. #7 by link on 24 de julho de 2016 - 12:23 am

    When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three e-mails with the same comment. Is there any way you can remove people from that service? Many thanks!

  7. #8 by http://jenchoy.com/files/listado-home.php on 24 de julho de 2016 - 12:44 am

    your new goaltender’s about to end up being better than they are experienced, solidly. get real, i would personally disburse budget to look out [all the caps], I wouldn’t normally be charged personal savings to watch after Detroit, and furthermore in it’s mainly because they do make a few mistakes always Detroit may each make. But feels these types of positively playing nevada taste,

  8. #9 by life insurance lawyer on 24 de julho de 2016 - 2:32 am

    very couple of web-sites that happen to be comprehensive below, from our point of view are undoubtedly nicely worth checking out

  9. #10 by Belgian Waffle Maker Reviews on 24 de julho de 2016 - 4:09 am

    You are a poor junior teacher of pc science and are short of cash.. A computer journal offers you a stable side work writing. 1 short article a month for three years. 36 months. The capture is the manager wants you to write approximately. the 12 different types of computer programing different languages. And the 12 different types of pc tasks.. And the 12 various kinds of computer programmers… Before you get your first check the editor desires 3 lists of 12 types… So have a slice of wonder loaf of bread (builds solid bodies 12 ways) and. make a list from the 12 different types of computer developers… Note: the other two lists are posted because similar, but separate questions..

  10. #11 by wafflemakerdiva on 24 de julho de 2016 - 4:23 am

    Great work! This is the type of info that are supposed to be shared across the internet. Shame on the seek engines for now not positioning this put up upper! Come on over and seek advice from my web site . Thank you =)

  11. #12 by Timhome.vn on 24 de julho de 2016 - 6:04 am

    Hey, you used to write excellent, but the last few posts have been kinda boring?K I miss your great writings. Past several posts are just a bit out of track! come on!

  12. #13 by http://gsrescue.org/wp-includes/muvek_eva.php on 24 de julho de 2016 - 6:13 am

    I’m an ancient banker converted adventure capitalist, musician and performer and over committed offer. a family firm, T2 go transformation, is normally dedicated to growing significant initiate agents, and as well as leading the buildout using the environments that create the parties. excellent measure was main strategies specialist.

  13. #14 by Maribel Braim on 24 de julho de 2016 - 6:28 am

    I visited a lot of website but I conceive this one holds something extra in it in it

  14. #15 by funeral order of service on 24 de julho de 2016 - 6:48 am

    It would be great if I could post text and images to the blog from my cell (iPhone). Maybe also video??.. Now i am new in the whole weblog thing, therefore it really would need to be free and fairly easy to use… THANKS!.

  15. #16 by Smart Balance Wheel on 24 de julho de 2016 - 7:50 am

    Really love these people! I haven’t got everything unfavorable to say of the entire group. They actually are my personal favorite Smart Balance Wheel http://www.fashionhoverboard.com!!!!!

  16. #17 by Booker Guice on 24 de julho de 2016 - 8:39 am

    My programmer is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the expenses. But he’s tryiong none the less. I’ve been using Movable-type on several websites for about a year and am worried about switching to another platform. I have heard very good things about blogengine.net. Is there a way I can import all my wordpress posts into it? Any help would be greatly appreciated!

  17. #18 by Collen Pullian on 24 de julho de 2016 - 6:42 pm

    Your house is valueble for me. Thanks!…

  18. #19 by my charisma condos on 24 de julho de 2016 - 6:50 pm

    Hi there just wanted to give you a quick heads up. The words in your article seem to be running off the screen in Internet explorer. I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured I’d post to let you know. The layout look great though! Hope you get the issue resolved soon. Many thanks

  19. #20 by Fake Hyman on 24 de julho de 2016 - 9:52 pm

    Hey! Your website is amazing! I will recommend it to my daugther and any person that could be enticed by this object. Great work guys 😀

  20. #21 by discount tasers for sale on 25 de julho de 2016 - 4:15 am

    I simply wanted to construct a message to be able to thank you for all the amazing advice you are showing at this website. My extended internet look up has now been paid with good tips to go over with my close friends. I would admit that we visitors actually are very fortunate to live in a remarkable network with very many brilliant professionals with great techniques. I feel really privileged to have encountered your entire webpages and look forward to many more brilliant times reading here. Thanks once more for everything.

  21. #22 by life insurance lawyer on 25 de julho de 2016 - 4:18 am

    Here are a number of the web-sites we recommend for our visitors

  22. #23 by Randy Doede on 25 de julho de 2016 - 7:43 am

    COA labels

  23. #24 by Faux Hymen on 25 de julho de 2016 - 8:00 am

    Hey! This website is great :) I will recommend it to my friends and anyone that could be enticed by this subject. Great work girls 😀

  24. #25 by Thuy Northrup on 25 de julho de 2016 - 8:15 am

    Guillermo Valls

  25. #26 by Emmett Polucha on 25 de julho de 2016 - 8:19 am

    geo news

  26. #27 by Horace Ketelhut on 25 de julho de 2016 - 11:10 am

    Apple now has Rhapsody as an app, which is a great start, but it is currently hampered by the inability to store locally on your iPod, and has a dismal 64kbps bit rate. If this changes, then it will somewhat negate this advantage for the Zune, but the 10 songs per month will still be a big plus in Zune Pass’ favor.

  27. #28 by http://esskayeng.net/html/241.html on 25 de julho de 2016 - 11:19 am

    sThe premium that it awesome, conversely, mainly because that models run limited accept they a person dimensions up.If you’re 5f 4inches after that span wants modifying or exclusively use completely high sneakers. Other than that loved their gown

  28. #29 by http://www.beautynationpl.cn/cn/_notes/43.html on 25 de julho de 2016 - 11:20 am

    sThe high quality this very good, nevertheless, due ones models run smaller accept they one size upwards.If you are 5f 4inches therefore length wants adjusting or exclusively use quite tall shoes. Other than that adored that outfit

  29. #30 by http://sanjumemorialtrust.org/js/lib/212.html on 25 de julho de 2016 - 11:21 am

    That headset was like beautiful since within the photo. They arrived immediately. I’d encourage utilizing a towel over every one layer while you click that outside w / the steam iron. It doesn’t steam outside along with merely a steamer. That iron was required. It can be fine, when you never trust your self with all the towel and vapor iron, after that just take things up to a certified. Breathtaking noise.

  30. #31 by http://www.zjlkcy.com/cn/js/lib/31.html on 25 de julho de 2016 - 11:22 am

    This one headset ended up being as spectacular while within the visualize. This appeared promptly. I’d suggest utilizing a towel more than each layer while you press they away w / per vapor iron. It does not steam outside using only a steamer. Their iron was needed. It can be delicate, when you you should not trust your self aided by the towel and/or vapor iron, then just take it up to a certified. Beautiful appear.

  31. #32 by http://www.candicoindia.com/download/ABC/232.html on 25 de julho de 2016 - 11:28 am

    It is an great gifts to the loved ones. I would highly incourage individuals to get this things makes a awesome present. Their sender does outstanding time task with buying the particular items on time period. I ordered my personal items daily ago and I also reveived it certainly fast.

  32. #33 by http://www.kransebinderiet.as/Templates/Folder/128.html on 25 de julho de 2016 - 11:29 am

    Recieved this particular product before the day provided in a really amazing gift container . That the photo that is shown for bracelet was what you can expect to recieve. This is certainly very fine however a pretty part regarding precious jewelry that will continue due iof that toggle clasp and is extremely durable so the bracelet eill not come off.

  33. #34 by samurai katana on 25 de julho de 2016 - 4:04 pm

    great service hope to deal with you again! LOVE IT!!!

  34. #35 by Patrica Barkhimer on 25 de julho de 2016 - 6:52 pm

    I’ll gear this review to 2 types of people: current Zune owners who are considering an upgrade, and people trying to decide between a Zune and an iPod. (There are other players worth considering out there, like the Sony Walkman X, but I hope this gives you enough info to make an informed decision of the Zune vs players other than the iPod line as well.)

  35. #36 by handmade katana on 25 de julho de 2016 - 11:39 pm

    Lisser transaction! Je vous remercie !

  36. #37 by http://www.nbjnwy.com/html/12.html on 25 de julho de 2016 - 11:43 pm

    This one headset had been while stunning since inside photo. Information technology arrived quickly. I’d advise choosing a towel through every coating while you push information technology away w / a vapor iron. It doesn’t steam over with merely a steamer. That iron ended up being appropriate. It can be sensitive, when you cannot trust yourself because of the towel and/or vapor iron, then need that it to a pro. Awesome noise.

  37. #38 by http://www.sxhams.com/cn/swf/page/25.html on 25 de julho de 2016 - 11:43 pm

    The headset ended up being like beautiful like inside image. Information technology appeared promptly. I would encourage getting a towel through each and every level while you press this over w / one steam iron. It does not vapor out with merely a steamer. Their iron is required. It is very sensitive, so if you never trust yourself with the towel to vapor iron, subsequently accept they up to a expert. Perfect noise.

  38. #40 by louis vuitton borsa trucco on 26 de julho de 2016 - 1:14 am

  39. #41 by save on VPN service on 26 de julho de 2016 - 2:19 am

    Unquestionably consider that which you stated. Your favorite reason seemed tobe on the web the easiest factor to keep in mind of. Isay to you, I certainly get irked even as other folksconsider issues that they plainly don’t know about. You controlled to hit the nailupon the top and defined out the entire thingwithout having side-effects , other folks could take a signal.Will probably be back to get more. Thank you

  40. #42 by simple recipe on 26 de julho de 2016 - 3:29 am

    Zune and iPod: Most people compare the Zune to the Touch, but after seeing how slim and surprisingly small and light it is, I consider it to be a rather unique hybrid that combines qualities of both the Touch and the Nano. It’s very colorful and lovely OLED screen is slightly smaller than the touch screen, but the player itself feels quite a bit smaller and lighter. It weighs about 2/3 as much, and is noticeably smaller in width and height, while being just a hair thicker.

  41. #43 by kawa brazylia santos on 26 de julho de 2016 - 3:41 am

    I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post.

  42. #44 by website directory on 26 de julho de 2016 - 3:57 am

    WOW just what I was looking for. Came here by searching for meta_keyword

  43. #45 by Elmer Ormond on 26 de julho de 2016 - 4:00 am

    Thank you a lot for sharing this with all people you actually recognize what you’re speaking about! Bookmarked. Please additionally talk over with my web site =). We could have a hyperlink alternate arrangement among us!

  44. #46 by clay tempered swords on 26 de julho de 2016 - 4:04 am

    SUPER fast shipping!!!!! Great item!!!!! Thank you!!!!!!!

  45. #47 by Josie Malasky on 26 de julho de 2016 - 5:06 am

    An interesting discussion is price comment. I believe that you must write more on this matter, it may not be a taboo topic however usually people are not enough to talk on such topics. To the next. Cheers

  46. #48 by health information on 26 de julho de 2016 - 7:13 am

    The new Zune browser is surprisingly good, but not as good as the iPod’s. It works well, but isn’t as fast as Safari, and has a clunkier interface. If you occasionally plan on using the web browser that’s not an issue, but if you’re planning to browse the web alot from your PMP then the iPod’s larger screen and better browser may be important.

1 62 63 64
(não será publicado)