Create a zenon Project template in Visual Studio

In reference to IU-17,.Net Windows Form Controls in zenon, Page 26 for extending interface functionality of zenon, developers can develop controls by performing a special configuration in Visual Studio .Net.
To simplify the development of a control by Visual Studio .Net a zenon project template can be created which is reusable. Furthermore, a zenon control template can also be created in the same way if necessary.
An eligible zenon project contains a control and can be integrated in zenon but must include several prerequisite settings mentioned in IU-17,.Net Windows Form Controls in zenon, Page 26.

STEP 1:
Create a project type: Windows Form Control Library

STEP 2:
Register the control as a dual control through registering for COM interop.

STEP 3:
Make the managed control visible for COM and set ClassInterface attributes.

STEP 4:
Add necessary entries and ActiveX attributes in the code designer.

STEP 5:
Take necessary steps to register control as an ActiveX in the Registry.

How to parametrize template

After configuring the project it must be customized with parameters for further use as a template. Each project must have a unique GUID for registering therefore this GUID must be generated automatically for each project creation. To implement this, the “$guid1$” parameter must be used instead of existing GUID in AssemblyInfo.cs file.

VisualStudio_zenonProjectTemplate_1_1

The second position which needs a unique GUID in the template is the class of control. It must be changed as follows and the GUID must be replaced with “$guid2$”.

VisualStudio_zenonProjectTemplate_1_2

How to create a template

After replacing the guids with parameters which are reserved template parameters, the template can be created.

  1. File menu > Export Template. The Export Template wizard opens.
  2. Project Template option must be selected.
  3. The current project must be selected in the list.
  4. Click Next.

VisualStudio_zenonProjectTemplate_1_3
Assign a name to the zenon project template.

  1. Assign a description.
  2. Assign an icon to the project template and all the assigned values will be shown in New Project dialog.
  3. Click Finish.
  4. The result of creating a template

VisualStudio_Screenshot_1_4

For further information Microsoft’s reference links can be used.

Using a predefined project template lessens the probability of errors during development. Because for developing a control for zenon environment are some settings necessary which can be forgotten and with lack of them, control cannot be created how it’s expected.

To remove the template from Visual studio .Net

It’s enough to delete the zip files from the following folders:

  • My Documents\Visual Studio Version\Templates\ItemTemplates
  • My Documents\Visual Studio Version\Templates\ProjectTemplates

References

 

(The COPA-DATA Blog Team would like to thank Parisa Moosavi from EDAG Production Solution for her zenon insights)

Tags: ,

Leave a Reply