Cross-platform development with Visual Studio
May 12, 2015UX Design; Elevator Controls
June 1, 2015One of the many options that is available to developers each time they create a new project in Visual Studio is how to configure the platform targeting options in the project properties dialogs Build panel. In the latest versions of Synergy there’s probably not much to worry about because the default values probably do exactly what you want most of the time, but the default values were not the same in some older versions of Synergy .NET, so it’s a good idea to have a good understanding of what your options are, and what the implication of choosing each option is.
In Synergy 10.3.1a we’re talking about two options; the Platform target drop-down and the Prefer 32-bit checkbox.
The Platform target drop-down allows you to select from three different ways that the assembly that is created by your project (the .DLL or .EXE file) can be created; essentially you are choosing which .NET CLR (and Framework) will be used to execute your code. The options are:
Any CPU (default) | Assembly can be executed by either the 64-bit or 32-bit CLR, with 64-bit preferred. |
x86 | Assembly can ONLY be executed by the 32-bit CLR on an Intel x86 CPU. |
x64 | Assembly can ONLY be executed by the 64-bit CLR on an Intel x64 CPU. |
It is important to understand that we’re not talking about which Synergy runtime components will be used, we’re talking about which .NET CLR will be used, and the matching Synergy runtime components must be present on the system in order for the assemblies to be used.
The Prefer 32-bit checkbox (which was added in Synergy 10.3.1a and is only available when the platform target is set to Any CPU) provides the ability for you to determine that even though your assembly will support both 32-bit and 64-bit environments, you would prefer that it executes as 32-bit if a 32-bit environment is available.
The chart below summarizes which environment (32-bit or 64-bit) will be selected for all possible combinations of platform targeting settings and deployment platform.
A red n/a entry in the table indicates that an assembly would not be available for use in that particular environment.
So what’s the take-away from all of this? Well it’s pretty simple; Stick to the defaults unless you have a good reason to do so. The current default is Any CPU, Prefer 32-bit which means that on Intel x86 and x64 systems your apps will run as 32-bit. This in turn means that you only need to install the 32-bit version of Synergy on runtime only systems unless you also need to run services such as license sever, xfServer, xfServerPlus or SQL OpenNET on the same system. Development systems should ALWAYS have 32-bit and 64-bit Synergy installed.