Synergy projects, solutions, and files

This topic includes the following sections:

 

When you develop with Visual Studio, Synergy DBL code files are contained in Synergy projects, and projects are contained in Visual Studio solutions.

Unlike projects, solutions are not language specific. A solution can contain a mix of Synergy and non-Synergy projects, it can contain a mix of traditional Synergy and Synergy .NET projects, and projects in a solution can share resources. For example, if you use the same core code for a traditional Synergy application and a Synergy .NET application, you can create a solution with a traditional Synergy project and a Synergy .NET project that both use that code, as illustrated in figure 1 below. In this configuration, the shared code would be included in both projects that use it (at least one project would add it as a link).

Note, however, that Synergy .NET projects cannot reference traditional Synergy projects and libraries, and vice versa. So if you have a solution with both traditional Synergy and Synergy .NET projects, you can build the projects together, but you probably won’t be able to deploy them as a single application.

1. A solution can have different types of projects, and different projects can share source files.

For more information on Synergy .NET projects and how they relate to .NET assemblies, see Projects for Synergy .NET.

Project files and folders

Each Synergy project consists of a project folder, a project file (or files), and other associated files and subfolders—just like projects for other languages in Visual Studio, so see Visual Studio documentation for general information on projects. There are, however, a few differences with Synergy projects:

Additionally, note the following:

File types and build actions

By default, Visual Studio treats Synergy project files with the .dbl and .dbc extensions as compilable Synergy code files, it treats Synergy project files with .def and .rec extension as content (non-compilable) files, and it treats files with the .rps, .scm, .schema, .sdl, and .sch extensions in repository projects as repository schema files. You can customize this by

A source file’s Build Action setting determines how it will be treated at build time. You can set the Build Action for a file in a Synergy project to one of the following (files with unrecognized extensions default to None):

2. Changing the Build Action for a specific source file in a project.

Builds

When you build a project in Visual Studio, Visual Studio automatically runs a Synergy compiler (and linker for traditional Synergy) behind the scenes to generate program and library files. For traditional Synergy, these are ELBs and DBRs (.elb and .dbr files by default). And for Synergy .NET, these are executables and DLLs (.exe and .dll by default). Additionally, a solution or project can be built to run as a 32-bit or 64-bit application or library, it can be built in debug or release mode, and it can be built to target an earlier version of Synergy/DE.

These and other aspects of project and solution builds are controlled by project settings and configuration/platform settings in Visual Studio (see Build page of Visual Studio project properties and Configurations, platforms, and profiles). But you can also control them with build settings and targets in project files (.synproj) and in MSBuild .props and .targets files. For example, if you want extensions to be in all capital letters for all files built for a traditional Synergy solution, you could add the following to a Directory.Build.Props file in the root directory for the solution:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(OutputType)'=='mainline' OR '$(OutputType)'=='traditional'">
<TargetExt>.DBR</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(OutputType)'=='elb'">
<TargetExt>.ELB</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(OutputType)'=='olb'">
<TargetExt>.OLB</TargetExt>
</PropertyGroup>
</Project>

With the above settings, when the OutputType for a project is set to “mainline” or “traditional”, the file extension for the built file will be .DBR. And if the OutputType for a project is “elb” or “olb”, the extension for built the built file will be .ELB or .OLB.

The next example, however, applies to all projects in a solution if it’s added to a Directory.Build.Props file in the root directory for the solution. For example, when using dotnet publish, it uses the win-x64 platform setting for all project dependencies in the solution:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
</PropertyGroup>
</Project>

Keep in mind that a setting in an MSBuild property or target file may be overridden by a setting in a project file or a different MSBuild file. Settings in target files (e.g., Directory.Build.Targets) typically override settings in project files (.synproj files), while settings in MSBuild property files (e.g., Directory.Build.Props) do not. This is because MSBuild loads property files before loading the project, but it loads target files after loading the project.

For more information on settings in project files and MSBuild property and target files, see Microsoft documentation (e.g., MSBuild Properties).

Output folders

When a project or solution is built, the output path, which is set on the Build page of project properties, determines where built files for the projects will be located. Build page settings are specific to a platform/configuration combination, so there can be as many output folders as there are platform/configuration combinations. For example, if you have a traditional Synergy solution with Debug, Release, and Test solution configurations and x86 and x64 solution platforms, the default output path settings for these configurations and platforms would result in the output folders shown in figure 3.

3. Output folders for a solution with traditional Synergy projects.

And if you have a Synergy .NET project with Debug, Release, and Test configurations and the Any CPU platform, the default output path settings for these would result in the output folders shown in figure 4.

4. Output folders for a solution with Synergy .NET projects.

For more information see Configurations, platforms, and profiles.