Prerequisites
In order to get and compile an SVN build yourself, you need the following tools:
- A Mercurial client such as TortoiseHG – http://tortoisehg.bitbucket.org/
- The Windows Installer XML (WiX) toolset – http://wix.sourceforge.net/(Version 3.0 of the Wix toolkit is required)
- Microsoft Visual Studio 2008 Professional Trial – http://www.microsoft.com/downloads/details.aspx?FamilyID=83c3a1ec-ed72-4a79-8961-25635db0192b&displaylang=en if you wish to debug, otherwise the Express version is sufficient – http://www.microsoft.com/express/vcsharp/
- Microsoft .NET Runtime 3.5
Make sure all these tools are installed.
Downloading the Mercurial code
1 Create a folder on your hard disk to hold the downloaded source, e.g. D:\Mercurial\!MediaBrowser_Trunk
2 Right-click that folder, click “Tortoise HG” and then click “Clone”

3 In “Source Path”, type https://videobrowser.googlecode.com/hg/ videobrowser then click on the “Clone” button to begin downloading. (The space before “videobrowser” at the end is intentional)

4 Once the download has completed the folder will now contain a copy of the latest trunk which you can compile by following the next section of this tutorial.
5 In order to update your copy of the code after the initial download, right-click your trunk folder, select “Tortoise HG” again, and then click “Synchronize”

6 Set the “Post Pull” option to “Update” and then click the “Pull” button

7 If any changes are found, the program will update your local copy and then display “Command Completed Successfully”, you can now compile the code.
8 If you want to update to a different branch then need to right-click the trunk folder, select “Tortoise HG” and then select “Update”

9 In the window which appears, select the branch you want to use from the drop-down, and then click “Update”

Compiling the Mercurial code
Step 1: Visual Studio
First you need to build the “solution” (the program) using Visual Studio. Proceed as follows:
If you don’t already have Media Browser installed on this computer, you must create the following folder structure `C:\ProgramData\MediaBrowser\Plugins` otherwise you will get errors trying to write to that location that doesn’t exist.
1 Open your Checkout folder in Windows Explorer.
2 Double-click the MediaBrowser.sln file (type: Microsoft Visual Studio Solution)(Note you may not see the .sln file extension on your PC)
- If an error message such as TestMediaBrowser.csproj cannot be opened, not supported by this installation appears, you may ignore it in most cases; just click OK.
- Before you compile, we need to set Visual Studio to compile in Release mode otherwise you get errors during the next phase with MSBUILD.EXE, to do this you will need to find the green arrow on the toolbar, next to it is a drop down box with Debug, Release and Configuration Manager options, select Release.

3 On the right side of the program you should see “Solution MediaBrowser (13 projects)”. Right-click it, then click “Build Solution”.

4 Check the Status Bar and wait for the message “Build Succeeded”.`(Note that I often get failed and in the error list there are several Warnings that can be ignored regarding interface issues etc that will let the developers know of things that need to be cleaned up, and I always get 1 Error that doesn’t seem to effect anything: The property ‘ContentStringFormat’ does not exist in XML namespace ‘http://schemas.microsoft.com/winfx/2006/xaml/presentation’.)
5 Close Visual Studio.
If you compile the source code under Windows 7 you should ensure, that you executed Visual Studio in Administrator mode, since otherwise the compilation will fail. This happens because the build scripts try to copy some files to a write protected area on your hard disk.
Step 2: Building the Installer
Now you need to compile the Installer program using MSBUILD.EXE, which is a part of Microsoft .NET 3.5. Proceed as follows:
1 Go to your Checkout folder in Explorer, then to the “Installer” folder.
2 Right-click the file “Installer.wixproj” and choose Open With.
3 Click the Browse button and navigate to C:\Windows\Microsoft.NET\Framework\v3.5
4 Click once on MSBUILD.EXE, then click on the Open button, then the OK button.

5 A DOS window appears with status messages which you can probably ignore. If the MSI was created, you can skip to Step 3 below, Putting it all Together
(Optional if build fails)
1 If the MSI is not created, try to run the MSBUILD command from the command line to see any errors.
2 Click “Start”, then in the “Search” or “Run” box type: cmd Then click the OK button.
3 Run the command: C:\windows\Microsoft.NET\Framework\v3.5\MSBuild.exe D:\SVN\!MediaBrowser_Trunk\videobrowser\Installer\Installer.wixproj
(Note the path to the Installer.wixproj assumes you downloaded the trunk to the location in the beginning of this tutorial.)
4 You can disregard any yellow warnings, you are looking for warnings in red text to help you find the problem. Note the Green “Build Succeeded” message.

Step 3: Putting it all Together
1 Choose or create a folder into which you'll put the ready-to-install MediaBrowser program (say, D:\MediaBrowser).
2 Go to your Checkout folder, then to the \MediaBrowser\bin\Release subfolder. Select all but the .PDB file(s), and copy them to your install folder (e.g. D:\MediaBrowser). If nothing has changed, you should have the following files:
MediaBrowser.dll
Fonts_DoNotEdit.mcml
Styles_DoNotEdit.mcml
3 Now go to the \Installer\bin\Release\en-us subfolder of your Checkout folder, and copy the MediaBrowser.msi file to your install folder.
Optional Fix if installer fails and rolls back
1 Run Regedit
2 Drill down to HKEY_LOCAL_MACHINE\Software\Microsoft\windows\currentversion\mediacenter\extensibility\entrypoints
3 The folder will NOT say Media Browser. It will be a jumbled mess of numbers and letters. click on each folder and MAKE SURE you have the right one. When it says Media Browser in the details pane on the right part of the Regedit window, delete it.

You're ready to install ! Have fun !