Setup of Development Environment for Windows: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
 
(115 intermediate revisions by 9 users not shown)
Line 4: Line 4:
'''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!'''
'''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 "i" series (i3, i5, i7) of Intel processors.
* A multi-processor PC has its advantages.
** Both the SharpDevelop IDE and the Visual Studio IDE's 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 =
= Required software =


== Microsoft .NET 3.5==
== Microsoft .NET Framework 4 and Windows 10 ==
Download and install the two Microsoft .NET dependencies. They allow execution of and development for .NET applications (such as openPETRA).
 
Download and install the Windows Software Development Kit (SDK) for Windows 10. This allows development of Windows applications incl. .NET applications (such as OpenPetra).
 
Note: If you attempt to install the 'Windows Software Development Kit (SDK) for Windows 7 and .NET Framework 4' on Windows 10 you will receive the cryptical message 'Some Windows SDK components require the RTM .NET Framework 4. Setup detected a pre-release version of the .NET Framework 4. If you continue with Setup, these components will not be installed. If you want to install these components, click Cancel, then install the .NET Framework 4 from http://go.microsoft.com/fwlink/?LinkID=187668 and then rerun Setup.'! Following that advice leads to nowhere - you must install 'Windows Software Development Kit (SDK) for Windows 10'!!!
 
* '''Windows Software Development Kit (SDK) for Windows 10'''
** https://dev.windows.com/en-us/downloads/windows-10-sdk
* '''.NET Framework 4.7.2 Developer Pack'''
** https://dotnet.microsoft.com/download/thank-you/net472-developer-pack


* Free downloads from Microsoft
Once the setup has finished it suggests to run 'Windows Update' to check whether any updates or security patches are available.
** '''Microsoft .NET 3.5 SP1 Redistributable'''
*** http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en
**** Follow the 'Instructions' section on that web page and read the 'Important' section.
*** This is ''not needed'' (and will indeed not work!) if you are installing on ''Windows 7'', because the .NET Redistributable is already pre-installed (or even the Microsoft .NET 4 Redistributable, which will also work).
** '''Windows Software Development Kit (SDK), .NET 3.5 SP1'''
*** http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505
*** 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 two dependencies. It might also be a good idea to run 'Windows Update' ''after'' installing those two dependencies to check whether any updates or security patches are available.
Note: Both the Redistributable '''and''' the SDK are needed!


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)
== Microsoft Visual C++ Redistributable Version 2015 ==
This might be installed by default already. But for some situations, you might only have older versions of "Microsoft Visual C++ Redistributable" installed. You need version 2015 for libsodium dlls to be loaded (see https://github.com/openpetra/openpetra/issues/174).


* Download at https://www.microsoft.com/download/details.aspx?id=48145


== SharpDevelop 3 ==
== SharpDevelop ==
SharpDevelop is the IDE (Integrated Development Environment) we use for developing openPETRA.
SharpDevelop is the IDE (Integrated Development Environment) we use for developing openPETRA.


* Free download: http://www.icsharpcode.net/OpenSource/SD/Download/
* [http://www.icsharpcode.net/OpenSource/SD/Download/ Free download]
* We currently use the latest SharpDevelop 3.2 build (Build 5777). (We ''don't'' recommend using the Beta version of SharpDevelop 4!)
** We currently use SharpDevelop 5.1 RC1, from 14 July 2015.
*** SharpDevelop has got a dependency on the [http://www.microsoft.com/en-us/download/details.aspx?id=5582 Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)]!
*** You will need to install this first (the SharpDevelop Installer will tell you that in case it isn't installed on your machine yet and not go ahead with the install).
 
* Developers ''within OM'' that need to open ''legacy Petra 2.x C# Solutions and Projects'' will also need to install SharpDevelop 3.2.1 to avoid the need of converting these to newer SharpDevelop Solution and Project formats every time they get opened:
** http://www.icsharpcode.net/OpenSource/SD/Download/GetFile.aspx?What=Setup&Release=Montferrer
*** SharpDevelop 3.2.1 has got a dependency on .NET 3.5 SP 1!
*** You will need to install this first (the SharpDevelop Installer will tell you that in case it isn't installed on your machine yet and not go ahead with the install).
*** To get that installed on Windows 10, do the following: Go to Control Panel / Programs and Features / Turn Windows features on or off and tick ".NET Framework 3.5 (includes .NET 2.0 and 3.0)" - Windows 10 will install it and tell you once it is finished. Then install SharpDevelop 3.2.1.


* Modifying Text Editor options
** The [[Coding Standard and Guidelines#White_Spaces | 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 / Plink==
==PuTTY / Pageant==
[http://www.putty.org/ PuTTY] is a SSH and telnet client for the Windows platform. Plink is a command-line interface to the PuTTY back ends, which is used by Git and TortoiseGit (see below).
[http://www.putty.org/ 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) and Bazaar (within OM, see below).


Free download: [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY Download Page]
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'.
* In the section 'Binaries', choose the installer under the heading 'A Windows installer for everything except PuTTYtel', e.g. [http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-installer.exe putty-0.60-installer.exe]
* Run the installer and remember the path where you install PuTTY into - you need to specify the path during the installation of Git and TortoiseGit (the installers need to be pointed to the file 'plink.exe' in that directory when they ask for it).


Free download: [http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html PuTTY Download Page]
* In the section 'Package files', choose the installer under the heading 'MSI (Windows Installer)', e.g. [https://the.earth.li/~sgtatham/putty/latest/w32/putty-0.68-installer.msi putty-0.68-installer.msi]
* Since version 0.68 there is also a 64-bit release. If you run a 64-bit Windows then this is fine to use, it yields slightly better performance than the 32-bit version.
* Run the installer.


== Git and TortoiseGit ==
Load your private key (a .ppk file if generated from putty) with pageant. See [https://wiki.openpetra.org/index.php/Submitting_patches_and_features Submitting Patches And Features ].
The [http://code.google.com/p/msysgit/ Git Source Code Management System] is a distributed source code versioning system (as opposed to central source code versioning systems, such as CVS and SVN).
For extra information on how to generate a private key you can refer to this tutorial - [https://winscp.net/eng/docs/ui_puttygen Generating Keys]
We use Git for the maintenance of the openPETRA source code repository.


[http://code.google.com/p/tortoisegit/ TortoiseGit] is a Windows client for Git which integrates nicely into the context menu of the Windows Explorer.  
== Open Source OpenPetra Developers: Git/TortoiseGit ==
* Install TortoiseGit from https://code.google.com/p/tortoisegit/wiki/Download
* After that, install Git for Windows: https://git-for-windows.github.io/
** Please use the option: Checkout Windows-style, commit Unix-style line endings ("core.autocrlf" is set to "true")


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.


===Git on Windows===
== OM-OpenPetra Developers: Bazaar ==
Free download: [http://code.google.com/p/msysgit/ Git on Windows]
See [[Notes about Bazaar]]


Note: use the official git installer from that site, eg. [http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.0.2-preview20100309.exe Git-1.7.0.2-preview20100309.exe], labelled 'Full installer for official Git', not the packages that have 'fullinstall' or 'netinstall' in their name, or any other packages.
== WinMerge ==
[http://winmerge.org/downloads/ 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.


'''Installation options'''
== Uncrustify ==
* 'Select Components' page of the installer: leave everything as it is.
We use Uncrustify to automatically format the code so that it looks more the same.
* 'Adjusting your PATH environment' page of the installer: leave the radio button on 'Use Git Bash only'.
* 'Choosing the SSH executable' page of the installer: Set the radio button to 'Use (Tortoise)Plink' and specify the path to the 'plink.exe' executable by using the '...' button (this is the path that you installed PuTTY into).
* 'Configuring the line ending conversions' page of the installer: leave the radio button on 'Checkout Windows-style, commit Unix-style line endings'.


===TortoiseGit===
Speaking of formatting code, please have a look at [[Coding Standard and Guidelines]] too.
* Free download: [http://code.google.com/p/tortoisegit/downloads/list TortoiseGit]
** Note: There are installers for 32bit and 64bit Windows. Choose the correct one according to your operating system architecture.
** TortoiseGit is still work in progress, but works fine on Windows (we have encountered some minor hiccups, though).
** ''Please install "Git on Windows" ''before'' installing TortoiseGit (see above)!''


'''Installation options'''
We are currently using version 0.56, and it is best that all developers use the same version.
* We recommend to use plink.exe from PuTTY, not OpenSSH.


===Alternative Windows Client===
Please use our own installer for Uncrustify, from http://sourceforge.net/projects/openpetraorg/files/openpetraorg/Tools/Uncrustify-Setup-0.56.exe/download
You also might want to have a look at [http://code.google.com/p/gitextensions Git Extensions], which is also a fully functional git GUI for Windows.


For more details see [[Uncrustify]]


===Setting up the Git repository===
== NUnit ==
''After installing Git and TortoiseGit (or Git Extensions), please follow our [[Notes about Git]] to configure your local git repository for openPETRA use!''
We use NUnit (http://www.nunit.org/, or https://launchpad.net/nunitv2/) for running automated tests.


At the moment we are using version ''3.5.0''. (Our friends at ICT need to still use version 2.6.1 for compatibility.)
Please note: it is better not to use a newer version of NUnit than NAnt supports. You might run into this problem: [http://stackoverflow.com/questions/16393665/unit-testing-with-roslyn-services-workspace-results-in-a-securityexception-while]
System.Security.SecurityException : Type System.Runtime.Remoting.ObjRef and the types derived from it (such as System.Runtime.Remoting.ObjRef) are not permitted to be deserialized at this security level.
See also [[Working with NUnit tests]]


== NAnt ==
== 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.
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 [https://sourceforge.net/projects/nant/files/nant/0.90-alpha1/nant-0.90-alpha1-bin.zip/download NAnt 0.90-alpha1]
* Use our own NAnt Installer for Windows, which already includes the NAntContrib files.
** please use ''this'' version as it works for us. Some of the released alpha or beta versions do not work (Example: [http://sourceforge.net/project/showfiles.php?group_id=31650&package_id=23704&release_id=560184 0.86-beta1]; it breaks with message: Property 'sdkInstallRoot' has not been set.)
** it is available here: http://sourceforge.net/projects/openpetraorg/files/openpetraorg/Tools/NAnt-Setup-0.92.exe/download
* unzip the files to e.g. <code>c:\program files\nant</code>
* create file <code>c:\windows\nant.bat</code> with content:
@echo off
"C:\Program Files\NAnt\bin\NAnt.exe" %* -t:net-2.0
* [http://nant.sourceforge.net/release/0.90-alpha1/releasenotes.html Release Notes for NAnt 0.90-alpha1]


See also our [[Notes about NAnt]].
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 ==
== Database systems ==
Line 94: Line 132:
** '''SQLite''': no installation effort at all is required! See [[Notes about SQLite]]
** '''SQLite''': no installation effort at all is required! See [[Notes about SQLite]]
** '''PostgreSQL ''(recommended)'''''. See [[Notes about PostgreSQL]]
** '''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.
*** Get version 9.3 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]]
** '''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.
*** 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 =
= Optional Software =
Line 104: Line 146:
*** 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.)
*** 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:
* 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
** 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
** Inno Setup 5 for building setup files: http://www.jrsoftware.org/isdl.php
= Downloading of source code and configuring the build environment =


== Get the source code ==
===Open Source OpenPetra: Git===
The source code is managed with the Git source code versioning system.


= Get the source code =
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]].
The source code is managed with Git.
 
Please understand that we will provide write permissions only to the core members of the development team, just to keep the project on one track. We very much need your contributions though, and we will aim to quickly deal with submitted patches and code via the forum. This still has to be worked out how this works best to submit code that way.
 
You can get the source code in several ways:
* see the [https://sourceforge.net/scm/?type=git&group_id=260632 Git instructions at Sourceforge]
** that page describes how you can download anonymously from Git
* you can also browse the [http://git.openpetra.org Git repository online], and you can download a tar.gz snapshot of each version there
* for developers: more detailed instructions how to create the ssh key and where to upload it to Sourceforge: https://sourceforge.net/apps/trac/sourceforge/wiki/SSH%20keys
 
for anonymous access, you can use this URL to clone the repository with TortoiseGit:
git://openpetraorg.git.sourceforge.net/gitroot/openpetraorg/openpetraorg
 
for developer access (with write permissions), use this URL to clone the repository with TortoiseGit:
ssh://USERNAME@openpetraorg.git.sourceforge.net/gitroot/openpetraorg/openpetraorg
 
For development, I recommend you create a local branch, and switch to it. Then you pull updates from the server ("master") into your local branch, and push your updates up to the server in the master branch. Otherwise you get all sorts of problems with pushing and pulling, so don't commit to master at all. see also [[Notes about Git]]
 
 
= Configuration of Development Environment =
The recommended way of installing OpenPetra.org for development is to somewhere map a network drive, using the DOS command <code> subst</code>
 
For example:
mkdir c:\development
subst u: c:\development
 
Download the Git repository into u:\openpetraorg (it contains the .git directory, and the OpenPetra.build: U:\openpetraorg\OpenPetra.build, etc)
 
URL of the git repository:
    anonymous access: git://openpetraorg.git.sourceforge.net/gitroot/openpetraorg/openpetraorg
    developer access: ssh://USERNAME@openpetraorg.git.sourceforge.net/gitroot/openpetraorg/openpetraorg
      make sure that you set your username and email address in your git client


* Make a copy of the file OpenPetra.build-sample-windows.config and call it OpenPetra.build.config
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


copy OpenPetra.build-sample-windows.config OpenPetra.build.config
Please have a look at the following page: [[Submitting patches and features]]!


Please check your OpenPetra.build.config file and make sure the paths are all adjusted to your system and the version numbers in the paths are correct.
= 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.


= NAnt script =
Please go to [[Setup_of_Development_environment#Source_Code_and_Database_Configuration_Architecture|Source Code and Database Configuration Architecture]] for finishing your openPETRA development setup.
There is a central NAnt script that is able to generate a lot of code and is able to do all automated tasks in the OpenPetra project.


Please see [[Setup_of_Development_environment#NAnt_script|OpenPetra NAnt script]] for details
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]].

Latest revision as of 04:44, 16 March 2023

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 "i" series (i3, i5, i7) of Intel processors.
  • A multi-processor PC has its advantages.
    • Both the SharpDevelop IDE and the Visual Studio IDE's 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 and Windows 10

Download and install the Windows Software Development Kit (SDK) for Windows 10. This allows development of Windows applications incl. .NET applications (such as OpenPetra).

Note: If you attempt to install the 'Windows Software Development Kit (SDK) for Windows 7 and .NET Framework 4' on Windows 10 you will receive the cryptical message 'Some Windows SDK components require the RTM .NET Framework 4. Setup detected a pre-release version of the .NET Framework 4. If you continue with Setup, these components will not be installed. If you want to install these components, click Cancel, then install the .NET Framework 4 from http://go.microsoft.com/fwlink/?LinkID=187668 and then rerun Setup.'! Following that advice leads to nowhere - you must install 'Windows Software Development Kit (SDK) for Windows 10'!!!

Once the setup has finished it suggests to run 'Windows Update' to check whether any updates or security patches are available.

Note: Both the Redistributable and the SDK are needed!

Microsoft Visual C++ Redistributable Version 2015

This might be installed by default already. But for some situations, you might only have older versions of "Microsoft Visual C++ Redistributable" installed. You need version 2015 for libsodium dlls to be loaded (see https://github.com/openpetra/openpetra/issues/174).

SharpDevelop

SharpDevelop is the IDE (Integrated Development Environment) we use for developing openPETRA.

  • Developers within OM that need to open legacy Petra 2.x C# Solutions and Projects will also need to install SharpDevelop 3.2.1 to avoid the need of converting these to newer SharpDevelop Solution and Project formats every time they get opened:
    • http://www.icsharpcode.net/OpenSource/SD/Download/GetFile.aspx?What=Setup&Release=Montferrer
      • SharpDevelop 3.2.1 has got a dependency on .NET 3.5 SP 1!
      • You will need to install this first (the SharpDevelop Installer will tell you that in case it isn't installed on your machine yet and not go ahead with the install).
      • To get that installed on Windows 10, do the following: Go to Control Panel / Programs and Features / Turn Windows features on or off and tick ".NET Framework 3.5 (includes .NET 2.0 and 3.0)" - Windows 10 will install it and tell you once it is finished. Then install SharpDevelop 3.2.1.
  • 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) and Bazaar (within OM, 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 'Package files', choose the installer under the heading 'MSI (Windows Installer)', e.g. putty-0.68-installer.msi
  • Since version 0.68 there is also a 64-bit release. If you run a 64-bit Windows then this is fine to use, it yields slightly better performance than the 32-bit version.
  • Run the installer.

Load your private key (a .ppk file if generated from putty) with pageant. See Submitting Patches And Features . For extra information on how to generate a private key you can refer to this tutorial - Generating Keys

Open Source OpenPetra Developers: Git/TortoiseGit

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.

OM-OpenPetra Developers: Bazaar

See Notes about Bazaar

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

For more details see Uncrustify

NUnit

We use NUnit (http://www.nunit.org/, or https://launchpad.net/nunitv2/) for running automated tests.

At the moment we are using version 3.5.0. (Our friends at ICT need to still use version 2.6.1 for compatibility.)

Please note: it is better not to use a newer version of NUnit than NAnt supports. You might run into this problem: [1]

System.Security.SecurityException : Type System.Runtime.Remoting.ObjRef and the types derived from it (such as System.Runtime.Remoting.ObjRef) are not permitted to be deserialized at this security level.

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.

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 version 9.3 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

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

Open Source OpenPetra: Git

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 Source Code and Database Configuration Architecture 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.