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.
Create a project type: Windows Form Control Library
Register the control as a dual control through registering for COM interop.
Make the managed control visible for COM and set ClassInterface attributes.
Add necessary entries and ActiveX attributes in the code designer.
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.
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$”.
How to create a template
After replacing the guids with parameters which are reserved template parameters, the template can be created.
- File menu > Export Template. The Export Template wizard opens.
- Project Template option must be selected.
- The current project must be selected in the list.
- Click Next.
- Assign a description.
- Assign an icon to the project template and all the assigned values will be shown in New Project dialog.
- Click Finish.
- The result of creating a template
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
- Creating Visual Studio Template
- How to: Create Project Templates
- How to: Substitute Parameters in a Template
- Template Parameters
(The COPA-DATA Blog Team would like to thank Parisa Moosavi from EDAG Production Solution for her zenon insights)