Create your own packages and reuse them on other C1 sites
In one of the perspectives in C1, you can right-click an item and add it to a package, then create and download the package as a ZIP file when done. You can add the following items to the package:
- Flat files (like CSS, CS, ASPX, PNG, etc)
- Whole directory structures
- Layout templates
- Media files
- Data types (Global, Page datafoldersand Page metatypes)
- Data items from data types
- XSLT functions
- C# functions
- Pages
- Configuration settings from
~\App_Data\Composite\Composite.config - GUI localizations
Note: If you have created a package which you would like to share with other C1 developers, please contact us.
How to install and configure Composite.Tools.PackageCreator
- Install the Composite.Tools.PackageCreator package.
- If necessary, refresh the C1 console (F5) and a new prespective named Package Creator will appear.
- Edit relevant users in the Users perspective to grant them access to the Package Creator perspective.
How to use Composite.Tools.PackageCreator
- In the Package Creator perspective, you can either create a new package ("Create package") or upload an existing package's configuration file ("Upload config") from the context menu on Packages.
- On the
Basic tab of the package properties, you can set the following values:
- Name: The package name
- Group Name: The package's group name (or namespace)
- Version: The package's current version
- Author: The package author
- Website: The package's or the author's package website
- Read more URL: The URL of a age with more information on the package
- Description: The general description of the package
- Technical details: Detailed technical information on the package
- On the
Advanced tab of the package properties, you can set the following values:
- Id: The identifier of the package. You can generate your own GUID in Visual Studio (Tools > Generate GUID), use an online GUID generator (e.g. http://www.famkruithof.net/uuid/uuidgen) or accept the default value suggested by Package Creator.
- Flush on completion: Use this if you are adding XSLT functions to the package while the System Locking is set to "none" (see below)
- Can be uninstalled: Specify if the package can be uninstalled after ist installation.
- System locking: You can use one of three types of locking: None (no locking), Soft, Hard (your C1 website will be restarted after package installation complete).
- Reload console on completion: Use this option to indicate whether to reload the C1 administration console after the package's installation.
- Minimum version and Maximum version: The minimum and maximum versions of Composite C1 required by the package to work.
Now you can add various items to the package:
- Add functions, files or data types to the currently "active" package by right clicking an item in the perspective trees and clicking Add to the package in the context menu. You can also add all the pages, media files, meta type data and datafolder data to the package from the context menu of the package.
- If necessary, add configuration settings from
~\App_Data\Composite\Composite.configby expanding configuration and needed sections underneath, right-clicking the needed parameter and clicking Add to the package in its context menu. The setting will appear under the active package. - If you have multiple packages, you can set another package "active" by right clicking the package and clicking Set Active in its context menu.
To download the created package or get its configuration file:
- Right click your package and click Download package or Download config respectively.
- Once you have downloaded your package (a ZIP file), you can upload it to a different C1 site (System | Packages | Installed Packages | Local Packages | Install Local Package).
You can also export a GUI localization other than default to a package:
- Switch the GUI language to a non-default language: Tool | Regional Settings | C1 Console Language. (Note: On version 3.1 or earlier: Tool | Regional Settings | Regional Settings.)
- In the Package Creator perspective, right-click Packages and click Create <language name> package in the context menu.
- Provide the required package information and download a package as you normally do with a regular package. (Please see Exporting GUI localization as a package for more information.)
Replacing existing files when installing a package
By default, a package will not install files if these files already exist.
To allow overwriting existing files:
- Extract and edit install.xml from the package.
- In install.xml, locate the element
mi:PackageInstaller/mi:PackageFragmentInstallers/mi:Add[@installerType="Composite.Core.PackageSystem.PackageFragmentInstallers.FilePackageFragmentInstaller, Composite"]/Files - Locate files you want to overwrite during the installation (the File elements)
- Set their
allowOverwriteattribute to "true".
<mi:PackageInstaller xmlns:mi="http://www.composite.net/ns/management/packageinstaller/1.0"> <!-- skipped for readability --> <mi:PackageFragmentInstallers> <mi:Add installerType="Composite.Core.PackageSystem.PackageFragmentInstallers.FilePackageFragmentInstaller, Composite" uninstallerType="Composite.Core.PackageSystem.PackageFragmentInstallers.FilePackageFragmentUninstaller, Composite"> <Files> <File sourceFilename="~\MyFile.xml" targetFilename="~\MyFile.xml" allowOverwrite="true" /> </Files> </mi:Add> <!-- skipped for readability --> </mi:PackageFragmentInstallers> </mi:PackageInstaller>
- Save install.xml and add it back to the package overwriting the outdated install.xml in it.
Please note that by default, all the files are listed with the allowOverwrite attribute set to "false" while directories (the Directory elements under mi:PackageInstaller/mi:PackageFragmentInstallers/mi:Add[@installerType="..."]/Directories) - "true".
Requirements
Composite C1 version 2.1 or later