Configurations, platforms, and profiles
This topic includes the following sections:
A Visual Studio project or solution can be built for different platforms, different purposes (e.g., debug or release), and different versions of Synergy.
1. One solution or project can be built in multiple configurations for multiple platforms.
Visual Studio configurations, platforms, and profiles make this possible. Solution configurations and platforms identify collections of settings for solution builds. Project configurations and platforms identify collections of build and debug settings for projects, with one exception: profiles are used to identify collections of debug settings for .NET Core and .NET Standard projects. Configurations, platforms, and profiles are merely labels—for example, you could create one called fredconfig, fredplatform, or fredprofile.
- Project configurations and platforms work in pairs. Each paring (i.e., each project configuration/platform combination) represents a different set of settings on the Build and Debug project properties pages. When you change an option on one of these pages, that change (with other settings on that page) is saved to the configuration/platform combination specified at the top of the page. Then when you build the project, the configuration/platform used for the build (the active configuration/platform) determines which build is debugged and which debug settings are used.
- Project profiles represent Debug page settings for a .NET Core or .NET Standard project. When you change an option on the Debug page for one of these projects, that change (with other settings on the page) is saved to the profile selected in the Profile field near the top of the Debug page. Then when you debug the project, the profile name on the Start button on the Visual Studio toolbar (the button with the green triangle) determines which profile (which debug settings) will be used for the debug session. To select a different profile, use the drop-down list next to the Start button. (The active configuration/platform determines which build is debugged.)
- Solution configurations and platforms generally have the same names as project configurations and platforms, but their function is different. Each solution configuration/platform combination represents a collection of settings that determine which projects will be built and which project configuration/platform will be used for each project in the solution. When you build the solution, the active configuration/platform is used for the build. When you debug, the active configuration/platform determines which build is debugged and which debug settings are used.
The active configuration/platform can be set on the Visual Studio toolbar or in Configuration Manager (as discussed in Creating and managing configurations, platforms, and profiles below).
- If you build an individual project, the active configuration/platform specifies a project configuration/platform.
- If you build a solution, the active configuration/platform specifies a solution configuration/platform (which contains project configuration/platform settings for each project in the solution).
The example illustrated in figure 2 shows how a release build for 32-bit Windows and Synergy/DE 10.3.1a results from a solution configuration/platform combination, which in turn specifies project configuration/platform settings for each project in the solution.
2. A solution configuration/platform specifies project configuration/platform settings.
You can also use solution configuration/platform settings to reduce build time when developing large solutions by excluding projects that don't need to be built. See the Synergex YouTube video Creating a New Build Configuration for more information.
For information on how configurations and platforms effect output folders for builds, see Output folders.
Configurations and platforms included with SDI
SDI includes the project and solution configurations and platforms described below. You can change the settings that these platforms and configurations represent (see Creating and managing configurations, platforms, and profiles below), but we don't recommend changing their purpose (i.e., their characteristic settings). For example, don't change the Debug/x86 combination so that it creates release builds or targets Linux or 64-bit Windows.
SDI includes two configurations for projects:
- The Debug configuration, which by default includes the Debug setting for the "Debug/optimize code" option on the Build page of project properties. This means that Debug builds include symbol information to aid debugging (but compiled files are not optimized).
- The Release configuration, which by default includes the Optimize setting for the "Debug/optimize" option on the Build page of project properties. This means that release builds are optimized for performance but have minimal debugging information.
SDI includes different project platforms for traditional Synergy and Synergy .NET:
- For traditional Synergy, SDI includes two platforms for projects: x86 and x64. These are named for their default platform target settings (set on the Build page of project properties). For information on creating a platform setting to target Linux or OpenVMS, see Adding a Linux or OpenVMS platform for traditional Synergy below.
- For most Synergy .NET projects, SDI includes one project platform, Any CPU, because in most cases .NET projects use this setting. (This is named for its default platform target setting set on the Build page of project properties.) For .NET Core and .NET Standard, SDI also includes x86, which should be used for 32-bit development for these platforms.
SDI also includes a set of solution configurations and platforms with names that match the project configurations and platforms included with SDI. The solution configurations are Debug and Release. The solution platforms are Any CPU for Synergy .NET, and x86 and x64 for traditional Synergy. (.NET Core and .NET Standard also have x86.) By default, each configuration/platform combination represents a collection of project configuration/platform settings of the same name. For example, the solution-level Debug/x86 combination includes project-level Debug/x86 settings for all projects in the solution.
Creating and managing configurations, platforms, and profiles
You can create configurations and platforms for solutions and projects, you can create profiles for .NET Core and .NET Standard projects, and you can change the settings for configuration/platform combinations and profiles. The following outlines basic procedures (see Visual Studio documentation for details).
Use Visual Studio’s Configuration Manager (Build > Configuration Manager) to create solution configurations and platforms, and to configure settings for solution configuration/platform combinations. You can also use Configuration Manager (or the configuration and platform fields on the Visual Studio toolbar) to set the active configuration/platform combination, which is the one used for builds and debugging. Use the Debug page of project properties to create, delete, and change settings for profiles.
- To create a solution configuration or platform, select <New…> from the “Active solution configuration” or “Active solution platform” drop-down list at the top of the Configuration Manager window.
The New Solution Configuration or New Solution Platform window will open.
- To configure the settings for a solution-level build configuration (i.e., a solution configuration/platform combination), select the configuration and platform in the first two fields of the Configuration Manager window (i.e., make it the active configuration/platform). Then select project configuration/platform settings for each project in the solution. You can exclude a project by clearing the Build option for the project.
- To set the active configuration/platform combination, use the "Active solution configuration" and "Active solution platform" fields in Configuration Manager (or use the configuration and platform fields on the Visual Studio toolbar).
- To create or modify a profile for a .NET Core or .NET Standard project, use the Debug page of project properties. The Profile field near the top of the page determines which profile the settings on that page will apply to. The New and Delete buttons next to the Profile field enable you to create and delete profiles.
- To select the profile used when debugging a .NET Core or .NET Standard project, use the drop-down list next to the Start button (the button with the green triangle) on the Visual Studio toolbar.
The Configuration Manager is also used to create project configurations and platforms. However, the settings that a project configuration/platform combination represents are set on the Build page and the Debug page of project properties.
- To create a project configuration or platform, you’ll need to create a solution configuration or platform. Select <New…> from the “Active solution configuration” or “Active solution platform” drop-down list at the top of the Configuration Manager window. Then, in the New Solution Configuration window or the New Platform Configuration window, make sure the “Create new project configurations” option is selected.
- To change settings for a project configuration/platform combination, open project properties (Project > Project_name Properties) and change settings on the Build page and the Debug page, making sure the configuration/platform combination whose settings you want to modify is selected at the top of each page. See Build page of Visual Studio project properties and Debug page of Visual Studio project properties for more information.
Adding a Linux or OpenVMS platform for traditional Synergy
If you have an existing project you want to port to Linux or OpenVMS, you can use the Visual Studio Configuration Manager to create a configuration that targets Linux or OpenVMS. SDI includes three platform options (linux32, linux64, and vms) that enable you to create platform settings for porting projects to 32-bit Linux, 64-bit Linux, or OpenVMS.
||Open Configuration Manager (e.g., select Build > Configuration Manager from the Visual Studio menu) and select New from the “Active solution platform” drop-down list.
||In the New Solution Platform window, select linux32, linux64, or vms in the "Type or select the new platform" field, and select x64 or x86 for the "Copy settings from" option (see figure 3).
3. Selecting a platform for a new configuration.
||Make sure the “Create new project platforms” option is selected, and click OK.
||In the main Configuration Manager window, select the solution configuration you want to use (and make sure the new platform is selected). Then in the “Project contexts…” table, select the new platform for each project in your solution (see figure 4).
4. Selecting the new configuration for a project.
You can now select the new solution platform when you build the solution and when you set options in project properties (e.g., on the Build page).