How to include TcOpen in a project
As a TwinCAT 3 developer, you already have everything you need.
Your project looks like this. It's probably a bit more complex than this. .
1. Create a new C# class library project (.NET4.8, .NET5, NET6 when supported) in your solution and name it PlcProjectConnector
Right-click on the solution in Solution Explorer and select Add > New Project.
On the Add a new project page, enter library in the search box. Choose C# from the Language list, and then choose All platforms from the Platform list. Choose the Class Library template, and then choose Next.
On the Configure your new project page, enter
PlcProjectConnector
in the Project name box, and then choose Next.On the Additional information page, select .NET4.8 or .NET5 (or NET6 when supported), and then choose Create.
Microsoft Create a class library project tutorial => link
2.Expand your newly created project, right click on Dependencies
and select Manage NuGet Packages
.
Click on Browse
, search for TcOpen.TcoCoreConnector
and click on Install
Microsoft NuGet Package Manager tutorial => link
- If you have Inxton Builder extension just click on the Inxton build icon.
- If you don't have it expand
Dependencies
->Packages
in your Solution Explorer and right click onTcOpen.TcoCoreConnector
and selectOpen folder in File Explorer
. You will get to your NuGet folder (in my caseC:\Users\jozef.chmelar.ml.MTS\.nuget\packages\tcopen.tcocoreconnector\0.4.2-alpha.453
). There's a directory calledlib
and in it there's TwinCAT libraryTcoCore.library
- If you don't have it expand
3. Install this library as you would a regular TwinCAT library
Right click on PLC project: - Context menu of the References object in the PLC project tree - Button in the Library Manager - Advanced - Library repository - Click on Install and locate the .library file
Tutorial by Beckhoff here.
Done!
Now that you have TcOpen in your project I recommend to read more about it here. Or write your first sequence! here.
If you prefer a working template check out TcOpen.Hammer