Setup of Development Environment for Windows
Overview
All the development tools we use are open source themselves, so developers do not need to spend money to be able to partly or fully join the openPETRA development!
If you already have some or all of the software installed that is listed here, please make sure it is the same version that we specify before skipping the relevant section on this page!
Development Hardware Needed
Any PC that you would otherwise use for serious software development should suffice.
- As a rough guide, a PC with a processor speed of more than 2GHz and at least 1 GB of RAM should be OK.
- If your PC is below that specification, development will probably be possible, but rather slow and cumbersome.
- On the other hand: Timotheus works with a Acer One Netbook, N280 CPU 1.6 Ghz, 2 GB RAM; speed is fine.
- More than 2GB of RAM is not necessary if the only applications that you run simultaneously are the ones which are used for developing openPETRA.
- The faster the processor, the better.
- When compiling, it all comes down to processor speed, number of cores of the processor, and the architecture of the processor.
- We have seen quite a boost in compilation speed with the new "i" series of Intel processors.
- When compiling, it all comes down to processor speed, number of cores of the processor, and the architecture of the processor.
- A multi-processor PC has its advantages.
- The SharpDevelop IDE can do parallel compilations of Projects that aren't interdependent - that can speed up compilation notably (we saw an average of 20%-40% speed gain when comparing compilation of all the Client Projects on two processor cores compared to compiling on one processor core). We have verified this to scale very well on up to four processors (we don't have PC's with more processors than that...).
- NAnt (our build system) can do parallel compilations of Projects that aren't interdependent - that can speed up compilation notably. We have verified this to scale very well on up to four processors (we don't have PC's with more processors than that...).
- A 64-bit Operating System (e.g. Windows 7 64-bit) has no advantages for the purposes of developing openPETRA.
- Disk space needed: at least 1 GB
- about 300 MB of this will be needed for the source code and compiled binaries of openPETRA;
- about 200 MB will be needed for development environment software tools;
- roughly 500 MB [+/- 300 MB…] will be needed for the .NET 4 Redistributable and the corresponding SDK).
Time required for setting up an openPETRA development environment
Depending on the speed of your PC, and of course the speed of your Internet connection and the speed of the respective download servers, the setting of up of a development environment for openPETRA on Windows can take something between one and two hours.
Required software
Microsoft .NET Framework 4
Usually, Windows7 comes with the .Net 4 Framework Redistributable already installed. If your Win7 machine does not come with the full .Net 4 Framework Redistributable: you can install it from http://www.microsoft.com/en-us/download/details.aspx?id=17718
Download and install the Microsoft .NET SDK. This allows development for .NET applications (such as OpenPetra).
- Windows Software Development Kit (SDK) for Windows 7 and .NET Framework 4
- http://www.microsoft.com/download/en/details.aspx?id=8279
- When selecting install options don't forget to include the .NET development section (which includes "Intellisense and Reference Assemblies" and "Tools")
Microsoft recommends to run 'Windows Update' before installing those dependencies. It might also be a good idea to run 'Windows Update' after installing those dependencies to check whether any updates or security patches are available.
Note: Both the Redistributable and the SDK are needed!
SharpDevelop
SharpDevelop is the IDE (Integrated Development Environment) we use for developing openPETRA.
- Free download: http://www.icsharpcode.net/OpenSource/SD/Download/#SharpDevelop4x
- We currently use SharpDevelop 4.4.1, from 27/01/2014.
- Modifying Text Editor options
- The openPETRA Coding Standard and Guidelines specify that identation needs to be with <SPACE> characters and not <TAB> characters. To set up SharpDevelop to adhere to that standard, change the following setting: Menu 'Tools' -> 'Options…', then 'Text Edior' -> 'Behaviour', 'Tabs' GroupBox. Make sure that 'Convert Tabs to Spaces' is ticked and that 'Tab size' and 'Indentation size' are both set to '4'.
PuTTY / Pageant
PuTTY is a SSH and telnet client for the Windows platform. Pageant comes with PuTTY and is used to load a Private SSH Key; it is used by TortoiseGit (see below).
Pageant is needed for 'developer access' only, i.e. if you intend to feed your changes back to the openPETRA Github source code repository at some point. PuTTY and Pageant are not needed for 'anonymous access'.
Free download: PuTTY Download Page
- In the section 'Binaries', choose the installer under the heading 'A Windows installer for everything except PuTTYtel', e.g. putty-0.60-installer.exe
- Run the installer.
Load your private key (a .ppk file if generated from putty) with pageant. See https://sourceforge.net/apps/mediawiki/openpetraorg/index.php?title=Submitting_patches_and_features.
Git/TortoiseGit
- Install TortoiseGit from https://code.google.com/p/tortoisegit/wiki/Download
- After that, install Git for Windows: http://msysgit.github.io/
Please follow the instructions at How to work with git on the command line or How to work with git through the GUI on Windows to get the latest version of the code.
WinMerge
WinMerge is a very good tool on Windows to compare single files but also complete source code trees. See the WinMerge HowTo page for more information.
Uncrustify
We use Uncrustify to automatically format the code so that it looks more the same.
Speaking of formatting code, please have a look at Coding Standard and Guidelines too.
We are currently using version 0.56, and it is best that all developers use the same version.
Please use our own installer for Uncrustify, from http://sourceforge.net/projects/openpetraorg/files/openpetraorg/Tools/Uncrustify-Setup-0.56.exe/download
NUnit
We use NUnit (http://www.nunit.org/, or https://launchpad.net/nunitv2/) for running automated tests.
At the moment we are using version 2.6.0. (please note: it is better not to use a newer version of NUnit than NAnt supports)
See also Working with NUnit tests
NAnt
NAnt is our build system. It is used for ongoing compilation, for creation of Builds/Releases of openPETRA, and for the automation of quite a few tasks in the development lifecycle of openPETRA - including auto-generation of source code and Forms.
- Use our own NAnt Installer for Windows, which already includes the NAntContrib files.
See also our Notes about NAnt.
Another possible error while trying to compile with nant is the following:
generateFrameworkPath the path for the .NET Framework could not be found
Then you need to install Microsoft .NET Framework 4 SDK
Database systems
openPETRA works with a number of Database Management systems.
- Choose one (or more) of the following Database Management systems. (If you want to start development quickly, SQLite is sufficient, so there is no immediate need to install PostgreSQL or MySQL. PostgreSQL is recommended for serious development, however).
- SQLite: no installation effort at all is required! See Notes about SQLite
- PostgreSQL (recommended). See Notes about PostgreSQL
- get the latest version from http://www.postgresql.org/download/windows. The one click installer works fine for me.
- You need to add a Postgresql user/role in pgAdmin with your windows username. Give permissions to create roles and databases to that user.
- In order to see the OpenPetra tables with pgAdmin go to "Server" -> "PostgreSQL" or "localhost" -> "Database" -> "petra" -> "Schemas" -> "public" -> "tables" - or use the Search function by right-clicking on the database-name.
- MySQL. See Notes about MySQL
- get the latest Windows version from http://dev.mysql.com/downloads/mysql/. It is called MySQL Community Server. The MSI essential package works fine for me.
If you want to switch from SQLite to PostgreSQL which we recommend for serious development, please follow the instructions at Setup_of_Development_environment#Use_another_database_system.
Optional Software
- For the editing of YAML files (which we use for defining the layout of screens, the main menu entries, and code hierarchy) we use Notepad++, which has syntax highlighting support for YAML files.
- Download Notepad++
- Once the software is installed, it needs to be set up once to accept our file extension, '.yaml', in addition to the one is built in, '.yml' for the syntax highlighting to work:
- Menu 'Settings' -> 'Style Configurator'. Select 'YAML' in the 'Language' list and enter 'yaml' in the 'User ext.' field. Choose 'Save & Close'. (You might need to close and re-open any .yaml file that you already have open to get the syntax highlighting working.)
- The following pieces of software are only required when you want to build releases of OpenPetra:
- Poedit (for translation, generating the .mo file from the .po file): http://www.poedit.net/download.php (alternative: direct .mo file download from launchpad)
- Inno Setup 5 for building setup files: http://www.jrsoftware.org/isdl.php
FastReports Reporting Engine (FastReport, Fast Report)
FastReports is a third-party Reporting Engine that is used in the OM build of OpenPetra. OM purchased this commercial product because it is very fast, and it offers good control over output formatting.
If your build of OpenPetra does not include the FastReports DLLs, the built-in reporting engine will be used instead.
Developers within OM should follow these instructions to include the FastReports DLLs:
- Obtain the FastReports DLLs from the OpenPetra team. The required files are FastReport.dll, FastReport.Editor.dll, FastReport.Bars.dll, FastReport.xml and FRNetUserManual.chm.
- Copy the files into a new folder on your PC, outside of your source code workspace.
- Create an environment variable FASTREPORT_DLL_PATH containing the full path of the FastReports folder.
When the solution is next rebuilt with nant generateSolution, all the files in the folder will be copied to the delivery/bin folder, where they will be found by OpenPetra.
Downloading of source code and configuring the build environment
Get the source code
The source code is managed with the Git source code versioning system.
You should have got the source code already if you followed the instructions at How to work with git on the command line or How to work with git through the GUI on Windows.
Especially when using Windows 7 it is recommended to checkout into a local directory (e.g. on C:) and not one on the network as otherwise compiling with NAnt can give problems. Compiling from a network drive gave the following error on Windows 7:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, ... failed
Please have a look at the following page: Submitting patches and features!
Finally: Building openPETRA with NAnt
After completing all the steps that are involved in the setup of your development environment for openPETRA, you are ready for the compiling and starting of openPETRA!
We have a central NAnt script that is able to build openPETRA, to generate a lot of code and is able to do all automated tasks in the openPETRA project.
Please go to OpenPetra NAnt script for finishing your openPETRA development setup.
If you want to switch from SQLite to PostgreSQL which we recommend for serious development, please follow the instructions at Setup_of_Development_environment#Use_another_database_system.