Creating license requests
A TwinCAT license request file with the extension .tclrq contains the information required to generate a license. It is submitted to Beckhoff, which then issues the corresponding license file. Starting with TwinCAT Build 4026.7, this file can be generated directly via the Automation Interface. To do this, call ConsumeXml with an LicenseRequest element on the license node.
Requirements
- A TwinCAT solution is open, and a DTE connection is active.
ITcSysManagerwas initialized as a COM object in an STA thread.- TwinCAT from Build 4026.7.
- The target folder for the license request file exists.
- Provider, LicenseId, and CustomerId are known.
C# sample
The license node is accessed via the tree path TIRC^License. The LicenseRequest XML contains the required fields Provider, LicenseId, and CustomerId, as well as the target path in LicenseRequestFilePath. After calling ConsumeXml, the .tclrq file is located at the specified path.
// Look up license node (TIRC = TwinCAT Runtime Configuration)
ITcSmTreeItem licenseNode = sysManager.LookupTreeItem(@"TIRC^License");
string licenseRequestXml = @"<TreeItem>
<LicenseDef>
<LicenseRequest>
<Provider>Beckhoff Automation</Provider>
<LicenseId>1234</LicenseId>
<CustomerId>4321</CustomerId>
<Comment>Lizenzanfrage Projekt XY</Comment>
<LicenseRequestFilePath>C:\Temp\MyLicense.tclrq</LicenseRequestFilePath>
</LicenseRequest>
</LicenseDef>
</TreeItem>";
licenseNode.ConsumeXml(licenseRequestXml);
// The file is created at the specified path
PowerShell sample
# Look up license node (TIRC = TwinCAT Runtime Configuration)
$licenseNode = $sysManager.LookupTreeItem("TIRC^License")
$licenseRequestXml = @"
<TreeItem>
<LicenseDef>
<LicenseRequest>
<Provider>Beckhoff Automation</Provider>
<LicenseId>1234</LicenseId>
<CustomerId>4321</CustomerId>
<Comment>Lizenzanfrage Projekt XY</Comment>
<LicenseRequestFilePath>C:\Temp\MyLicense.tclrq</LicenseRequestFilePath>
</LicenseRequest>
</LicenseDef>
</TreeItem>
"@
$licenseNode.ConsumeXml($licenseRequestXml)
# The file is created at the specified path
![]() | The availability of this feature starts with TwinCAT Build 4026.7. When reading data via |
