UA Bundle SDK .NET  2.2.1.258
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Groups Pages
Creating an Empty Visual Studio Server Project

Create a New Project

Select “File → New → Project” from the menu. Select “Visual C#” from the tree and pick the template “Console Application”.

New Console
Application

Change project name and location to your liking.

Add References

Right click on “References” in the Solution Explorer and choose “Add Reference...” from the context menu.

Add Reference...

In the tab “.NET” of the newly opened window select UnifiedAutomation.UaBase and UnifiedAutomation.UaServer and confirm with “OK”

Select UaBase and
UaServer

Add the following line to the file Program.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using UnifiedAutomation.UaBase; // Add this line

Add License

Right click on your project in the Solution Explorer and choose “Add → New Folder” from the context menu.

Add New Folder

Name the newly created folder License.

License Folder

Right click on the License Folder and select “Add → Existing Item...”

Add Existing Item

Set the file filter to “All Files (*.*)”, navigate to a folder containing a license file (e.g. [Installation Directory]/UnifiedAutomation/UaSdkNetBundleBinary/examples/BasicClient/License), select the file License.lic and confirm with “Add”.

Pick License File

Right click on License.lic and select “Properties”. Set the build action to “Embedded Resource”.

Embed License

Add the following code to the file Program.cs to embed the license:

static void Main()
{
// new code begins
try
{
ApplicationLicenseManager.AddProcessLicenses(System.Reflection.Assembly.GetExecutingAssembly(), "License.lic");
}
catch (Exception e)
{
}
// new code ends
}

Configure Product

Add an App.config file via context menu “Add → Existing Item” to your project (e.g. from [Installation Directory]/UnifiedAutomation/UaSdkNetBundleBinary/examples/ServerGettingStarted/Lesson01). More information on configuration settings can be found in the first lesson, Options for loading configuration settings and in the documentation for the Base Library under Configuration Schema.

Right click on App.config and select “Properties”. Set the build action to “None”.

You are now prepared to start with Lesson 1: Setting up a basic OPC UA server console application