Developing for .NET Core
With Synergy .NET, you can create .NET Core console applications and libraries for Windows x86 and x64 systems.
The .NET Core framework is generally updated more quickly than .NET Framework, and .NET Core applications 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 framework versions on deployment machines will not affect your application. For more information, see Microsoft documentation for .NET Core — e.g., Microsoft's .NET Core Guide.
|
Projects created from Synergy .NET Core templates automatically include the Synergex.SynergyDE.synrnt and Synergex.SynergyDE.Build NuGet packages, which are required. When a Synergy .NET Core 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. See Microsoft documentation for more information (e.g., NuGet Package Manager UI).
|
.NET Core development steps
The following steps outline the basic procedure for creating a .NET Core application from Synergy templates. Most of these steps outline Visual Studio procedures, so see Visual Studio documentation 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 for .NET Core development: |
Console App (.NET Core)
Class Library (.NET Core)
Class Library (.NET Standard)
Synergy/DE Repository
For example, to create a .NET Core console application, select File > New > Project in Visual Studio. Then select the "Console Application (.NET Core)" 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:
- If no solution is open in the current instance of Visual Studio, creating a project will also create a solution to contain the project. To add the project to an existing solution, open the solution in Visual Studio before you create the project. To start with a blank solution, do the following before you create projects for the application: select File > New > Project from the Visual Studio menu, and then select the Blank Solution template. You can use the search feature in the New Project dialog to find this template.
- You can include Synergy projects in a solution for another .NET language (e.g., in a C# solution), and a solution with Synergy projects can include projects written in other .NET languages.
- For portability, put logic in .NET Standard class libraries. A .NET Standard class library can run on multiple platforms. See Developing .NET Standard libraries for more information.
|
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: |
- For information on which Synergy features are supported for .NET Core development, see Synergy DBL Support for .NET.
- See Performing Common Synergy .NET Coding Tasks for information on instantiating and using a .NET class, inheriting and overriding a .NET class, and more.
- For information on adding references or dependencies to Synergy repositories, see Using Synergy/DE repositories in Visual Studio.
- Use ASYNC routines for communication across networks and the internet. See Asynchronous processing (.NET) for more information.
- Synergy .NET Core assemblies require traditional Synergy licensing. (Device licensing is not supported for .NET Core.) See Licensing .NET assemblies.
- To generate documentation from comments in code, use ;;; to identify documentation comments in your code, and select the “XML documentation file” option on the Build page of project properties.
|
5.
|
Create preliminary builds and debug the project in Visual Studio using Visual Studio build and debug commands. When a .NET Core application is built from Visual Studio, it is built as a framework-dependent application, which is a .dll file designed to be run using the dotnet command (or from Visual Studio).
|
- For more information on building .NET Core and debugging, see Microsoft documentation.
- For debugging information specific to Synergy .NET, see Debugging Synergy .NET Code.
- For information on Build menu commands that enable you to build or rebuild (or clean) an individual project without affecting other projects in the solution (even referenced projects), see the Project Only information in SDI features.
|
6.
|
For the final, deployable build, use the dotnet publish command. See Microsoft’s documentation on deployment with CLI tools. The dotnet 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 a .NET Core solution, it creates a self-contained build (an .exe file) for .NET Core on 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. |