CODESYS Forge (or short cforge) is a small tool which should help developers and users to use the services offered on CODESYS Forge. cforge is basically written in C# but can be extended with IronPython scripts. As it makes use of IronPython and MS Scripting, you might have problems running it on anything else than Windows.
cforge itself is packed as a CODESYS package. That leads to the most important prerequisite: CODESYS programming system has to be installed on your PC.
There are different ways of installing cforge to your PC:
Installation via CODESYS package
If you have no cforge installed before, just use the "cforge<...>.package" and let CODESYS do the installation:
2) Double click on the (or execute the) cforge package file and let CODESYS install the package.
3) Now please go to your CODESYS installation folder. There should be a subfolder called "CFORGE". E.g.: C:\Program Files (x86)\3S CODESYS\CODESYS\CFORGE
4) Inside this folder, please execute the "Setup.bat".
This will do 2 important things for the cforge tool:
- Add this folder to your windows "path" environment variable (if not yet there)
- Add some magic registry entries for the mechanism of the URL protocol handler, so that links starting with "cforge:" do work on your machine.
But don't be afraid: it is that simple (if you need it for some other cool tools) ;-)
Installation/Update via cforge itself (experimental)
This works, as long as cforge was already installed (and setup) to your current CODESYS installation.
Then you can use cforge to update cforge.
... As this might currently lead to black holes, we will investigate that later.
CODESYS users which have this package installed get an easy access to all their favorite packes, drivers and projects from CODESYS Forge.
Packages can be installed as easy as clicking on the cforge download button of a project. cforge registers an URL protocol handler in Windows, which handles URLs, starting with the protocol "cforge:".
By clicking on such a link, the corresponding software is downloaded and installed using cforge.
All software, which was installed through cforge is registered and can be maintained, using the cforge command line.
usage: cforge <command> [options]
--list: list installed packages
--install <url>: install a package from.the given URL
--remove <package name>: uninstall a package with the given name
--checkout <url>: checkout SVN projects
--commit [<project file>]: autogenerate project file(s) and markdown, then commit everything
--release [<project>]: save project as compiled library, with the release flag set
--package [<package manifest>]: create package(s) based on the given manifest(s)
--username: used for SVN operations
--password: used for SVN operations
-r, --recursive: search recursively (for projects, package manifests, ...)
cforge helps developers in several reoccuring tasks of maintaining their CODESYS software.
You can always use the standard mechanisms of the CODESYS SVN package to check your projects out. But with cforge you can easily checkout a folder, containing multiple libraries.
You will end up with a folder with projects, that are up to date and have the right connection to the SVN repository that you just checked out.
Again, you can use the standard mechanism of CODESYS SVN to commit your changea on your projects. But here cforge has several advantages:
You can check in several projects and libraries at once
cforge will also commit every project in binary form, containing the SVN connection settings to your repository
cforge will commit a Markdown file, containing an export of the source code
Doing the same w/o cforge would need a lot more manual interaction:
Checkout every single project and library
Set the release flag in all libraries
Save all libraries as compiled library
Update a package manifest
Create a CODESYS package from the manifest
Commit the sources with CODESYS SVN
Commit the compiled libraries, packages and project files with an external SVN client
To be cleaned up later:
How to debug cforge tool (and its IronPython commands/scripts)
As it is a C# tool, just use Microsoft VisualStudio to run / attach to your local cforge instance.
There is a nice trick: just lay a file named "debug" (content does not matter) next to the cforge.exe and it will patiently wait when started (e.g. from the browser via a "cforge:" url), so that you have time to attach. Then just press Enter in the console (as it is mentioned there), and continue to debug.
Then you can even debug the IronPython scripts.