c:package

<c:package
  name? = type_name
  visibility? = "internal" | "public"
  version = decimal
  language = language
  default-mode? = eqname >
  <!-- Content: (c:import-namespace*, declaration*) -->
</c:package>

Represents an XCST package.

Permitted parent elements
None

Attributes

default-mode The default mode of template rules for the current module.
language The expression language for this module (usually "C#" or "VisualBasic").
name The fully-qualified class name for the current package.
version The XCST version for the current and descendant elements (usually "1.0").
visibility Specifies how the current package can be used from other assemblies.

In addition to the attributes in the preceding table, there are a number of standard attributes that may appear on any XCST element.

Remarks

An XCST program is called a package. The c:package element is used to create an explicit package. However, it’s often more convenient to use c:module as an implicit package.

The main difference between implicit and explicit packages is the default visibility of components. Implicit packages make named templates and modes public by default. On explicit packages all components are private by default.

A package consists of one or more modules. Modules are linked together by means of c:import declarations. The principal module is the module that all other modules are directly or indirectly referenced from. You can use both c:module and c:package as principal module, but only c:module can be imported into another module.

A c:package that uses the name attribute is a named package. Named packages can be used by other packages by means of a c:use-package declaration.

Scope of Package Parameters

A c:param whose parent is c:module, c:package or c:override is a package parameter. A package parameter is also a global variable.

Package parameters are visible to all other components in the containing package. Package parameters have an implicit public visibility, which also makes them visible to components in using packages.

Initialization of Package Parameters

Package parameters that are not required follow the same rules as global variables. See Initialization of Variables.

Package parameters that use required='yes' are initialized before the invocation of the initial component (usually the c:initial-template template).

See Also