Setup of Development Environment for Windows: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by 2 users not shown)
Line 28: Line 28:
= Required software =
= Required software =


== Microsoft .NET Framework 4 ==
== Microsoft .NET Framework 4 and Windows 10 ==


===Windows 7===
Download and install the Windows Software Development Kit (SDK) for Windows 10. This allows development of Windows applications incl. .NET applications (such as OpenPetra).
Usually, Windows7 comes with the .Net 4 Framework Redistributable (.NET Runtime) 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")
** Update: '''Microsoft .NET Framework 4.6.1 Developer Pack and Language Packs for Windows 7 SP1, Windows 8, Windows 8.1, Windows 10, Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2''': https://www.microsoft.com/en-us/download/details.aspx?id=49978
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!
===Windows 10===
Windows 10 comes with the .NET 4.6 Redistributable (.NET Runtime) installed.
Download and install the Windows Software Development Kit (SDK) for Windows 10. This allows development of Windows applications incl. .NET applications (such as OpenPetra).<br />
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'!!!
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'''
* '''Windows Software Development Kit (SDK) for Windows 10'''
** https://dev.windows.com/en-us/downloads/windows-10-sdk
** 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


Once the setup has finished it suggests to run 'Windows Update' to check whether any updates or security patches are available.
Once the setup has finished it suggests to run 'Windows Update' to check whether any updates or security patches are available.
Line 119: Line 105:
We use NUnit (http://www.nunit.org/, or https://launchpad.net/nunitv2/) for running automated tests.
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.1''.
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]  
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]  
Line 162: Line 148:
** Poedit (for translation, generating the .mo file from the .po file): http://www.poedit.net/download.php (alternative: direct .mo file download from launchpad)
** 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
=== OM-OpenPetra: FastReports Reporting Engine (FastReport, Fast Report) ===
[http://www.fast-report.com 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 =
= Downloading of source code and configuring the build environment =


Line 187: Line 160:


Please have a look at the following page: [[Submitting patches and features]]!
Please have a look at the following page: [[Submitting patches and features]]!
===OM-OpenPetra: Bazaar===
See [[Notes about Bazaar]] and inquire OM-specific setup information from the OM development team.


= Finally: Building openPETRA with NAnt =
= Finally: Building openPETRA with NAnt =

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.