| Version 21 (modified by Joel, 11 months ago) (diff) |
|---|
Compiling Eraser from Source
Get the necessary dependencies
Though Eraser (core) is written in C#, several sub-projects are written in C++ (the Shell Extension and Setup bootstrapper) and therefore dependencies do exist.
- 7-zip LZMA SDK (http://7-zip.org/sdk.html). The LZMA SDK is used for the setup bootstrapper.
- Boost C++ Libraries (http://boost.org). The Boost library is also used for the setup bootstrapper.
- Visual Studio Express Editions (http://www.microsoft.com/express/)
- You'll need these to compile Eraser.
- Visual C++ Express Edition. If you use the Express editions you cannot compile the Shell Extension (it depends on ATL, and indirectly MFC)
- Visual C# Express Edition
- Of course, Visual Studio Standard and above will be easier because of WiX integration and you also get to compile the Shell Extension.
- You'll need these to compile Eraser.
- If you wish to produce your own installer
- WiX (http://wix.sourceforge.net/)
- Eraser's Installer is written with a combination of both WiX and C++ for the bootstrapper. The Eraser Installer was written with WiX v3.0, so grab the stable release.
- .NET framework, get it from http://www.microsoft.com/downloads/info.aspx?na=22&p=3&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=&u=%2fdownloads%2fdetails.aspx%3fFamilyID%3dab99342f-5d1a-413d-8319-81da479ab0d7%26DisplayLang%3den
- 7-zip, to create the installation bootstrapper archive
- WiX (http://wix.sourceforge.net/)
Proceed to install what must be installed (notably Visual Studio and WiX)
Build the Dependencies
The only thing which must be built as of now is the 7-zip SDK.
- Extract the 7-zip LZMA SDK to a folder (hereafter referred to as %7z%)
- Extract 7zLib.zip to %7z%\C\Util and open %7z%\C\Util\7zLib\7zLib.vcproj or %7z%\C\Util\7zLib\7zLib.vcxproj, depending on your version of Visual Studio.
- Build the Release version
- Now, you should end up with a few object files and 7zLib.lib in %7z%\C\Lib\Release
- Add %7z% to the Compiler include path and %7z%\C\Lib\Release to the Linker library path
The Boost header files must also be reachable by the compiler.
- Extract the Boost library to a folder (%Boost%)
- Add %Boost% to the Compiler include path; Eraser does not depend on any Boost library as of now; the headers are sufficient.
Build Eraser
- Download the Eraser sources (instructions here: http://sourceforge.net/svn/?group_id=37015); hereafter referred to as %Eraser%
- Open %Eraser%\Eraser.sln
- Users of the Express Editions will be asked whether they want to open it as a C# project or a C++ project, open the C# project first.
- Build Eraser (Release)
- Visual Studio will ask for a Key File. Either you create your own (for private builds) or disable signing altogether.
- If you want to create your own Key File, Go to Eraser Project Settings | Signing. Under Choose a Strong Name Key file, click New...
- When prompted, key in Key File as the name, and uncheck the Protect My Key File with a Password checkbox.
- Go to the Eraser subdirectory and copy Key File.snk to the parent folder, together with the Eraser.sln file
- Do NOT commit your .snk file to the repository
- Binaries should exist in %Eraser%\bin\Release
- Visual Studio will ask for a Key File. Either you create your own (for private builds) or disable signing altogether.
Build the Installer
Todo: What about those without VS Standard+?
Build the MSI
- Create a Folder Merge Modules in the Installer folder
- Copy these files from C:\Program Files\Common Files\Merge Modules to the newly created Merge Modules folder.
- Microsoft_VC(90|100)_CRT_x86_x64.msm
- Microsoft_VC(90|100)_ATL_x86_x64.msm
- Microsoft_VC(90|100)_MFC_x86_x64.msm
- Microsoft_VC(90|100)_CRT_x86.msm
- Microsoft_VC(90|100)_ATL_x86.msm
- Microsoft_VC(90|100)_MFC_x86.msm
- Open %Eraser%\Installer\Installer.wixproj
- If you have Authenticode certificates, be sure to import them to your personal certificate store. The pre-build step for the Installer project will sign all binaries before packaging them into the MSI. Use the Certificates MMC Snap-in to manage your personal certificates.
- Change the Target Platform to x86
- Build the Installer project
- Change the Target Platform to x64
- Build the Installer project
- At this point %Eraser%\bin\Installer\x86\Release and %Eraser%\bin\Installer\x64\Release should each contain an Eraser.msi
- Copy each to %Eraser%\bin\Installer\Eraser (architecture).msi, i.e. %Eraser%\bin\Installer\Eraser (x64).msi
- Extract the .NET framework file, copy dotnetfx35.exe to %Eraser%\bin\Installer
- Use 7-zip to create an archive, Installer.7z with the two Eraser.msi's and dotnetfx35.exe, maintaining their file names
Build the Bootstrapper
- Open %Eraser%\Installer\Bootstrapper\Bootstrapper.vcproj
- Build the bootstrapper
- The bootstrapper should be created at %Eraser%\bin\Release\Bootstrapper.exe
- Create the setup archive
- Create an archive containing both MSIs created in the previous section, maintaining the names, as well as dotnetfx35.exe. I'll call it Installer.7z.
- Integrate the bootstrapper and the package
- Open a command prompt, cd to %Eraser%\bin\Installer, and run this command:
..\Release\Bootstrapper.exe --integrate Installer.7z --out Installer.exe
- Open a command prompt, cd to %Eraser%\bin\Installer, and run this command:
- Merge the Bootstrapper manifest into the Bootstrapper: the Bootstrapper is built with a manifest that allows the Bootstrapper to be run (without any payload) without administrator permissions. Now that the bootstrapper contains a live setup binary, the Bootstrapper should run with administrator permissions. We thus need to merge the manifest into the binary. Run this command:
mt /manifest ..\..\Installer\Bootstrapper\Bootstrapper.manifest /outputresource:Installer.exe
Congratulations, you have a ready-to-go installer!
