Setup of Development Environment for Windows: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
(no need for .net 2.0 anymore)
Line 28: Line 28:
= Required software =
= Required software =


== Microsoft .NET 3.5 and .NET 2.0==
== Microsoft .NET 3.5 ==
Download and install the three Microsoft .NET dependencies. They allow execution of and development for .NET applications (such as openPETRA).
Download and install the two Microsoft .NET dependencies. They allow execution of and development for .NET applications (such as openPETRA).


* Free downloads from Microsoft ('''All 3 are needed''')
* Free downloads from Microsoft ('''Both are needed''')
** '''Microsoft .NET 3.5 SP1 Redistributable'''
** '''Microsoft .NET 3.5 SP1 Redistributable'''
*** http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en
*** http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en
Line 41: Line 41:
*** ''ALTERNATIVE:'' '''Windows Software Development Kit (SDK) for Windows 7 and .NET Framework 4'''
*** ''ALTERNATIVE:'' '''Windows Software Development Kit (SDK) for Windows 7 and .NET Framework 4'''
**** http://www.microsoft.com/download/en/details.aspx?id=8279
**** http://www.microsoft.com/download/en/details.aspx?id=8279
** '''.NET Framework 2.0 Software Development Kit (SDK)'''
*** 32bit for all: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec
*** 64bit does not seem to work: [[Problems with .Net 2.0 SDK 64bit]]
*** There is no need to install all the components that are available - many involve huge further downloads! Only ".NET Development Tools" and "Debugging Tools for Windows" are needed for developing openPETRA.


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.
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! (We currently only use .NET 2.0 for openPETRA, but the SharpDevelop IDE requires .NET 3.5 SP1 Redistributable and SDK). The new nant build system now requires us to install the .NET 2.0 SDK as well, besides the .NET 3.5 SDK.
Note: Both the Redistributable '''and''' the SDK are needed!


== SharpDevelop ==
== SharpDevelop ==

Revision as of 07:20, 19 August 2011

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.
  • 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 3.5 SP 1 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 3.5

Download and install the two Microsoft .NET dependencies. They allow execution of and development for .NET applications (such as openPETRA).

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/
  • We currently use the latest SharpDevelop 3.2.1 (build 6466).
    • We don't recommend using SharpDevelop 4 yet - it has indeed got several nice features, but has got some problems at the moment:
      • There is a pretty bad bug with handling mouse clicks in the 'Projects' Dock Window - source code files are sometimes moved into 'random' C# Projects when a single mouse click is done on them :-(
      • It generates/modifies C# Project files with settings that aren't compatible with our nant build system (at least not as our build system is at the moment).
  • 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 Bazaar (see below).

Pageant is needed for 'developer access' only, i.e. if you intend to feed your changes back to the openPETRA Bazaar 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.

Bazaar

Please follow the instructions at How to work with bazaar on the command line or How to work with bazaar through the GUI on Windows to download Bazaar and 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.

Download the zip file from http://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.56/uncrustify-0.56-win32.zip/download and unzip it to your Program Files directory. We are currently using version 0.56, and it is best that all developers use the same version.

If you have different path then below, then you need to add an entry to your OpenPetra.build.config similar to the following with the correct path:

<property name="external.Uncrustify" value="${environment::get-variable('ProgramFiles')}/uncrustify-0.56-win32/uncrustify.exe"/>

Speaking of formatting code, please have a look at Coding Standard and Guidelines too.

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.

  • download NAnt 0.91-alpha2
    • please use this version as it works for us. Some of the released alpha or beta versions do not work (Example: 0.86-beta1; it breaks with message: Property 'sdkInstallRoot' has not been set.)
  • unzip the files to e.g. c:\program files\nant
  • open a Text Editor (e.g. Notepad, Notepad++) and create a new file with the file name c:\windows\nant.bat. It needs to have the following content:
@echo off
"C:\Program Files\NAnt\bin\NAnt.exe" %*

See also our Notes about NAnt.


Another posible 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 2.0

There is a problem with .Net 4.0:

Unhandled Exception: System.TypeInitializationException:
  The type initializer for 'NAnt.Console.ConsoleStub' threw an exception.
  System.Security.SecurityException: Request for the permission of type
  'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0'

see the article http://keithbloom.wordpress.com/2010/09/21/nant-and-the-net-4-error/ with the solution: Remove <supportedRuntime version="v4.0.30319" /> from %InstallLocation%\NAnt\bin\NAnt.exe.config

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).

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:


Downloading of source code and configuring the build environment

Get the source code

The source code is managed with the Bazaar source code versioning system.

You should have got the source code already if you followed the instructions at How to work with bazaar on the command line or How to work with bazaar 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.