Developing .NET Standard Libraries

The Synergy “Class Library (.NET Standard)” project template enables you to create class libraries that can be used for multiple platforms. Synergy .NET Standard libraries can run with .NET Framework (on Windows) and .NET 6 and higher (on Windows or Linux).

Note

Projects created from the Synergy “Class Library (.NET Standard)” template automatically include the Synergex.SynergyDE.synrnt and Synergex.SynergyDE.Build NuGet packages, which are required. When a Synergy .NET Standard project 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., Install and manage packages in Visual Studio using the NuGet Package Manager).

The following steps outline the basic procedure for using Visual Studio to create a .NET Standard class library. Most of these steps outline Visual Studio procedures, so see Visual Studio documentation for more information. Additionally, note that the Synergy .NET Standard project template, “Class Library (.NET Standard)”, and project item templates are available in NuGet packages (Synergex.Projects.Templates and Synergex.ProjectItem.Templates) which can be used to develop Synergy .NET Standard projects with the .NET CLI. For information on developing with the .NET CLI, see Microsoft documentation and the “Basic .NET CLI development steps” sections in Developing for .NET 6 or Higher and Developing for .NET Framework.

1. Start by reviewing Synergy .NET Requirements and the Synergy DBL Integration Requirements page. 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, open the solution for the application you want to add the library to, and then select File > New > Project from the Visual Studio menu.
3. In the New Project window, select the “Class Library (.NET Standard)” template. (You can use the New Project dialog’s search field to find this.) Set options as necessary (e.g., specify the name of the project), and then click OK.

The project is added to the solution that is currently open, and you can see a node for the project in Solution Explorer. (Select View > Solution Explorer to open Solution Explorer.) For more information on projects and solutions, see Projects for Synergy .NET.

4. Add DBL code, resources, and other items to the .NET Standard library project, and make sure it references any needed assemblies. See Synergy/DE item templates for information on new items you can add to a project, and note the following:
5. Set project properties, which include settings for 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.
6. Build and debug the solution. See Microsoft documentation for information on build features and the debugger. See Debugging Synergy .NET Code for debugging information specific to Synergy .NET. And see the Project Only information in SDI features for information on commands that enable you to build or rebuild (or clean) an individual project without affecting other projects in the solution, even referenced projects.
7. Deploy to machines that meet deployment requirements listed in Synergy .NET Requirements.

Note that you can create a NuGet package for a Synergy .NET Standard project by using the nuget pack command. For example:

nuget pack MyProject.synproj

For more information, see Microsoft documentation on the nuget.exe CLI.