Developing for .NET 6 or Higher

With Synergy .NET, you can create console applications and libraries for .NET 6 and higher on Windows and Linux. This topic, which includes the following sections, outlines the basic development steps for .NET 6 and higher.

Version 6 and higher of .NET are generally updated more quickly than .NET Framework versions, and applications for .NET 6 and higher generally take less memory, run faster, and make for smaller deployments than equivalent .NET Framework applications. Additionally, if you create a self-contained deployment, changes to .NET versions on deployment machines will not affect your application. For more information, see Microsoft documentation for .NET (e.g., learn.microsoft.com/en-us/dotnet/fundamentals/.)

Note

Synergy projects created for .NET 6 and higher automatically include the Synergex.SynergyDE.synrnt and Synergex.SynergyDE.Build NuGet packages, which are required. When one of these projects is created, the latest packages (that are not pre-release) are downloaded to a local NuGet repository for the project. To update NuGet packages for existing projects, you must use the NuGet Package Manager or a .NET CLI command (“dotnet...”). See Microsoft documentation for more information (e.g., learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio).

Basic development steps in Visual Studio

The following steps outline the basic procedure for using Visual Studio to create a Synergy application for .NET 6 or higher. Most of these steps outline Visual Studio procedures, so see Visual Studio documentation for more information.

1. Start by reviewing Synergy .NET Requirements and the SDI requirements page (www.synergex.com/synergy-dbl-integration). Then set options for your Visual Studio environment as necessary. For example, you can control the behavior of the Visual Studio code editor (indentation, tab size, etc.), the way IntelliSense works for Synergy DBL files, and which file types are automatically treated as compile or content files. See Options for Synergy/DE projects for more information.
2. In Visual Studio, create a project for each assembly in your application, and put all the projects for your application in one solution. You can use the following project templates:

Console App (.NET)

Class Library (.NET)

Class Library (.NET Standard)

Script

Synergy/DE Repository

Unit Test (.NET)

For example, to create a console application, select File > New > Project in Visual Studio. Then select the “Console Application (.NET)” template. (You can use the New Project dialog’s search field to find this.) See Synergy projects, solutions, and files for more information, and note the following:

3. Add DBL code, resources, and other items to the Visual Studio projects for your application, and make sure each project references any needed assemblies. See Synergy/DE item templates for information on new items you can add to a project, and note the following:
4. Set project properties, which include settings for licensing, deployment, and building/compiling. See Synergy/DE project properties. For information on setting environment variables for a project, see Environment variables and Visual Studio development.
5. Create preliminary builds and debug the project in Visual Studio using Visual Studio build and debug commands.
6. For the final, deployable build, use the “publish” command. See Microsoft documentation (e.g., learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli). The publish command enables you to create self-contained or framework-dependent builds. For example, when the following command is run in the same directory as the solution, it creates a self-contained build (an .exe file) for Windows x64:
dotnet publish -c Release -r win10-x64
7. Deploy to machines that meet deployment requirements (including licensing requirements) listed in Synergy .NET Requirements.

Basic .NET CLI development steps

The following steps outline a basic procedure for using the .NET CLI (i.e., "dotnet" commands) and Visual Studio to create a Synergy application for .NET 6 or higher. Most of these steps outline .NET CLI procedures, so see Microsoft documentation on the .NET CLI for more information.

1. Whether you deploy to Windows or Linux, you'll develop on a Windows machine. Make sure that machine meets the requirements listed in Synergy .NET Requirements and the SDI requirements page (www.synergex.com/synergy-dbl-integration).
2. Use the following commands to install the Synergy project and item templates, which are available in nuget.org:
dotnet new install Synergex.Projects.Templates
dotnet new install Synergex.ProjectItem.Templates

If you get an error such as “Synergex.ProjectItem.Templates could not be installed, the package does not exist”, the problem could be that the NuGet feed (https://api.nuget.org/v3/index.json) is not set up as a package source on your system. See Microsoft documentation on package sources for information on adding this package source.

3. Use the “dotnet new template_shortname” command (where template_shortname is one of the names listed in the “Short name” column below) to create a project for each assembly in your application. And put all the projects for your application in one solution (e.g., by using the “dotnet sln add” command). You can use the following project templates:
Template name Short name
Class Library (.NET) synNETLib
Class Library (.NET Standard) synNETStandardLib
Console App (.NET) synNETApp
Script synScriptProj
Synergy/DE Repository synRepoProj
Unit Test (.NET) synNETUnitTest

For example, the following command creates a new Synergy .NET console app named TestApp:

dotnet new SynNETApp -n TestApp
4. Once you’ve created projects and a solution, you can add DBL code, resources, and other items to the projects, and you can set project properties. It’s generally best to do this in Visual Studio (see step 3 and step 4 in Basic development steps in Visual Studio above), but you can use .NET CLI commands, modify project files, etc.
5. Do preliminary builds and debugging in Visual Studio. See step 5 in Basic development steps in Visual Studio above. (Alternatively, you can do much of this step with the .NET CLI. See Microsoft documentation on the .NET CLI for more information.)
6. For the final, deployable build, use the “dotnet publish” command. See step 6 in Basic development steps in Visual Studio above.
7. Deploy to machines that meet deployment requirements (including licensing requirements) listed in Synergy .NET Requirements.