Install MozillaBuild, a package of additional build tools. Make sure you install this with a directory path that does not contain any spaces (e.g. c:\mozilla-build\). If you get a message saying this application did not install properly then you should see a windows dialog giving you the option to re-install with the 'correct settings'. After that all should be well.
We need to make sure that windows is using the SDK that we have just installed. Find "Windows SDK Configuration Tool" on your start menu, run it. Select "v7.0" (or higher) in the drop down box and click "make current".
Now we need to create your mozconfig file. This will contain various compile options for your custom build of firefox. Substituting {username} for your real username, you should find your mozconfig file here: C:\Users\{username}\mozilla-central\mozconfig
I recommend that unless you know what your doing or run into compile issues that are specific to your system then edit your mozconfig file to look like this:
Hurrah, that's all of the setup out of the way. Now we can try and compile firefox! Open a shell window by running: c:\mozilla-build\start-msvc9.bat. Even if you're on 64-bit Windows, do not use the files ending in -x64.bat.
In the newly opened shell window type the following:
To get the latest source:
hg clone http://hg.mozilla.org/mozilla-central/
To navigate to the mozilla-central directory:
cd mozilla-central
To start the build process:
make -f client.mk
Once compiled (It may take hours depending on your system) the firefox executable can be found in C:\Users\{username}\mozilla-central\objdir-ff-release\dist\bin
I recommend you create a shortcut to the executable and don't open it directly. This way you can have it run from a different firefox profile and have it running at the same time as your standard firefox build while keeping the two completely seperate. This will prevent the addons etc from erroring about the unsupported firefox version. The short cut should be formatted as such: "Firefox.exe" -p "{PROFILE}" -no-remote (note: substitute the name of your profile for {PROFILE} or omit to launch the profile manger instead). I've set mine to "Firefox.exe" -p "nightly" -no-remote