Server Development Tutorial

Step 1 - Creating a new Server Project

In this section you will copy an existing project, rename it, add it to the existing solution, and then rename all resources as appropriate.

  1. Open Visual Studio .NET 2013 and then open the Sample Applications Source Code solution:
    OPC UA 1.02 .NET StackAndSamples [xxx]\UA Quickstart Applications.sln

  2. We will now duplicate the Reference Server project:

    1. Now switch to Windows Explorer.

    2. Locate the "Reference Server" project, which is in the following default location:
      OPC UA 1.02 .NET StackAndSamples [xxx]\SampleApplications\Workshop\Reference

    3. Right-click on the "Server" directory and choose Copy.

    4. In the same "reference" folder you will right-click and then Paste.

    5. A duplicate folder called "Server - copy" will be created. Rename this folder as appropriate.

    6. Double-click the new folder to open it.

    7. Rename the file "Reference Server.csproj" as appropriate, e.g. "MyServer".
      Note: this will not rename all resources as necessary.

    8. Switch back to Visual Studio .NET 2013.

  3. Within this solution you can Add the project that you copied in the previous step:

    1. Right-click on the Reference" folder that is visible within the Solution Explorer, choose Add Existing Project.

    2. Using the navigation window locate, highlight, and select the *.csproj that you renamed in step 2.7 above.

    3. The newly added project will be added to the solution and visible in the solution explorer.

  4. Now rename the remaining resources as appropriate:

    1. Assembly name:

      1. Open the properties of the newly added project.

      2. Modify the "Assembly name", e.g. "Quickstarts.MyServer".

      3. Modify the "Default namespace", e.g. "Quickstarts.MyServer".

        Note: The removal of "Quickstarts." from the namespace will require additional work to help the compiler locate referenced classes; in some cases you will need to modify the "using" references to properly specify the locations of referenced classes.

    2. Product Renaming:

      1. Within the current project, conduct a search and replace "ReferenceServer" with the intended name, e.g. "MyServer".

      2. Again, within the same project conduct a search and replace "Reference Server" with the intended name, e.g. "My Server".

      3. You may also with to rename the "OPC Foundation" branding as your own company, in which case simply search and replace ""OPC Foundation" (note the quote before OPC) with your company name, e.g. "My Company".

      4. Rename the configuration file "Quickstarts.ReferenceServer.Config.Xml", e.g. "Quickstarts.MyServer.Config.Xml".

    3. Compile the application and run it to make sure that it opens and that the application name matches your expectations.

    4. If you are an inquisitive person you might try connecting a UA Client to your newly created UA Server.

At this point you have created a clone of the Reference Server. In the next section you will define the address space.