.NET Based OPC UA Client/Server SDK  3.0.10.493
Create an Empty Visual Studio Client Project

Create a New Project

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

clienttutorials_empty_project.png
New Windows Forms

Application"

Change project name and location to your liking.

Delete the following line from the file Program.cs

static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); // delete this line
...

Add References

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

clienttutorials_empty_project2.png
Add Reference...

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

clienttutorials_empty_project3.png
Select UaBase and UaClient

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.

clienttutorials_empty_project4.png
Add New Folder

Name the newly created folder License.

clienttutorials_empty_project5.png
License Folder

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

clienttutorials_empty_project6.png
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”.

clienttutorials_empty_project7.png
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()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// 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/BasicClient). More information on configuration settings can be found in the documentation for the Base Library under Configuration Schema.

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

Start ApplicationInstance

Add the following method to Program.cs, where “Form1” is the automatically created form when creating the new project:

static class Program
{
[STAThread]
static void Main()
{
...
}
// new code begins
[STAThread]
static void Run(object userState)
{
System.Windows.Forms.Application.Run(new Form1());
}
// new code ends

Add the following code to Program.cs to start ApplicationInstance:

...
try
{
ApplicationLicenseManager.AddProcessLicenses(System.Reflection.Assembly.GetExecutingAssembly(), "License.lic");
ApplicationInstance.Default.Start(Run, null); // Add this line
}
...