You can create your own project templates, which can be selected in the Templates area of the New Project dialog when creating a new project (*.project or *.library). You can also define whether the project template should be contained in one of the Projects and Libraries folders displayed by default in the dialog or in a folder which you have created yourself. These folders are displayed in the “New Project” dialog in the “Categories” area.
-
In CODESYS Development System, create a project to be used as a template for other projects.
-
Save the project in the Templates folder of the installation directory of CODESYS.
-
In a text editor, create a new template file <template name>.template.
-
Edit this file according to the following sample file:
<?xml version="1.0" encoding="utf-8"?>
<ProjectTemplate>
<Name>
<DefaultString>Test_Project_Template</DefaultString>
<LocalizedString Culture="de">Test_Projekttemplate</LocalizedString>
</Name>
<Folder>
<DefaultString>Projects</DefaultString>
<LocalizedString Culture="de">Projekte</LocalizedString>
</Folder>
<Description>
<DefaultString>A project with a GVL</DefaultString>
<LocalizedString Culture="de">Ein Projekt mit einer GVL</LocalizedString>
</Description>
<DefaultFileName>
<DefaultString>Test Project</DefaultString>
<LocalizedString Culture="de">Testprojekt</LocalizedString>
</DefaultFileName>
<Extension>.project</Extension>
<TemplatePath>TemplateTest.project</TemplatePath>
</ProjectTemplate>
-
Contents of the different tags:
-
“Name”: Name of the project template as it is displayed in the Templates area of the New Project dialog.
-
“Folder”: Name of the folder where the project template is stored. Is displayed in the Categories area of the New Project dialog.
If you specify the name of a folder which does not exist, then a new folder with this name will be created.
-
“Description”: Description of the project template
The description is displayed in the New Project dialog when a template is selected.
-
“DefaultFileName”: Default name for the new project. The name is displayed in the Name field of the New Project dialog and can be edited there.
-
Extension:
-
.project: This template is used to create a CODESYS project .project. -
.library: This template is used to create a library project .library.
-
-
“TemplatePath”: File path of the template project in ../Templates of the installation directory of CODESYS
Examples:
TemplateTest.project: The TemplateTest.project template project is located in the ../Templates directory.Library_Template/CODESYS_Template.library: The CODESYS_Template.library template project is located in the ../Templates/Library_Template directory. -
If the texts in CODESYS should be displayed in the language of the CODESYS interface, then add the translations to the tags with LocalizedString (see example above).
-
-
Save the created template file (.template) and store it in the ../Templates folder of the installation directory.
Now when you open CODESYS and click File → New Project, the project template which you have just created will be available in the “New Project” dialog for your new project.