Class Element

WiX Toolset

Class Element

Description
COM Class registration for parent Component.
Windows Installer references
Class Table, ProgId Table, Registry Table, AppId Table
Parents
AppId, Component, File, TypeLib
Inner Text
None
Children
Choice of elements (min: 0, max: unbounded)
  • FileTypeMask (min: 0, max: unbounded)
  • Interface (min: 0, max: unbounded): These Interfaces will be registered with the parent Class and TypeLib (if present).
  • ProgId (min: 0, max: unbounded): A ProgId associated with Class must be a child element of the Class element
Attributes
Name Type Description Required
Id Guid The Class identifier (CLSID) of a COM server. Yes
Advertise YesNoType Set this value to "yes" in order to create a normal Class table row. Set this value to "no" in order to generate Registry rows that perform similar registration (without the often problematic Windows Installer advertising behavior).  
AppId Guid This attribute is only allowed when a Class is advertised. Using this attribute will reference an Application ID containing DCOM information for the associated application GUID. The value must correspond to an AppId/@Id of an AppId element nested under a Fragment, Module, or Product element. To associate an AppId with a non-advertised class, nest the class within a parent AppId element.  
Argument String This column is optional only when the Context column is set to "LocalServer" or "LocalServer32" server context. The text is registered as the argument against the OLE server and is used by OLE for invoking the server. Note that the resolution of properties in the Argument field is limited. A property formatted as [Property] in this field can only be resolved if the property already has the intended value when the component owning the class is installed. For example, for the argument "[#MyDoc.doc]" to resolve to the correct value, the same process must be installing the file MyDoc.doc and the component that owns the class.  
Context List The server context(s) for this COM server. This attribute is optional for VB6 libraries that are marked "PublicNotCreateable". Class elements marked Advertised must specify at least one server context. It is most common for there to be a single value for the Context attribute. This attribute's value should be a space-delimited list containg one or more of the following:
LocalServer
A 16-bit local server application.
LocalServer32
A 32-bit local server application.
InprocServer
A 16-bit in-process server DLL.
InprocServer32
A 32-bit in-process server DLL.
 
Control YesNoType Set this attribute's value to 'yes' to identify an object as an ActiveX Control. The default value is 'no'.  
Description String Localized description associated with the Class ID and Program ID.  
ForeignServer String May only be specified if the value of the Advertise attribute is "no" and Server has not been specified. In addition, it may only be used when the Class element is directly under the Component element. The value can be that of an registry type (REG_SZ). This attribute should be used to specify foreign servers, such as mscoree.dll if needed.  
Handler String The default inproc handler. May be optionally provided only for Context = LocalServer or LocalServer32. Value of "1" creates a 16-bit InprocHandler (appearing as the InprocHandler value). Value of "2" creates a 32-bit InprocHandler (appearing as the InprocHandler32 value). Value of "3" creates 16-bit as well as 32-bit InprocHandlers. A non-numeric value is treated as a system file that serves as the 32-bit InprocHandler (appearing as the InprocHandler32 value).  
Icon String The file providing the icon associated with this CLSID. Reference to an Icon element (should match the Id attribute of an Icon element). This is currently not supported if the value of the Advertise attribute is "no".  
IconIndex Integer Icon index into the icon file.  
Insertable YesNoType Specifies the CLSID may be insertable.  
Programmable YesNoType Specifies the CLSID may be programmable.  
RelativePath YesNoType When the value is "yes", the bare file name can be used for COM servers. The installer registers the file name only instead of the complete path. This enables the server in the current directory to take precedence and allows multiple copies of the same component.  
SafeForInitializing YesNoType May only be specified if the value of the Advertise attribute is "no".  
SafeForScripting YesNoType May only be specified if the value of the Advertise attribute is "no".  
Server String May only be specified if the value of the Advertise attribute is "no" and the ForeignServer attribute is not specified. File Id of the COM server file. If this element is nested under a File element, this value defaults to the value of the parent File/@Id.  
ShortPath YesNoType Specifies whether or not to use the short path for the COM server. This can only apply when Advertise is set to 'no'. The default is 'no' meaning that it will use the long file name for the COM server.  
ThreadingModel Enumeration Threading model for the CLSID. This attribute's value must be one of the following:
apartment
free
both
neutral
single
rental
 
Version String Version for the CLSID.  
Remarks
When being used in unadvertised mode, the attributes in the Class element correspond to registry keys as follows (values that can be specified in authoring are in bold):
Id/Context/Server
In General
[HKCR\CLSID\{Id}\Context1]
@="[!Server]"
[HKCR\CLSID\{Id}\Context2]
@="[!Server]"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\LocalServer]
@="[!comserv.dll]"
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\LocalServer32]
@="[!comserv.dll]"
Id/Context/ForeignServer
In General
[HKCR\CLSID\{Id}\Context1]
@="ForeignServer"
[HKCR\CLSID\{Id}\Context2]
@="ForeignServer"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\LocalServer]
@="mscoree.dll"
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\LocalServer32]
@="mscoree.dll"
AppId
In General
[HKCR\CLSID\{Id}]
AppId="{AppId}"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}]
AppId="{00000000-89AB-0000-0123-000000000000}"
Argument
In General
[HKCR\CLSID\{Id}\Context]
@="[!Server] Argument"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\LocalServer32]
@="[!comserv.dll] /arg1 /arg2 /arg3"
Control
In General
Value "yes" specified:
[HKCR\CLSID\{Id}\Control]
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Control]
Description
In General
[HKCR\CLSID\{Id}]
@="Description"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}]
@="Description of Example COM Component"
Handler
In General
Value "1" specified:
[HKCR\CLSID\{Id}\InprocHandler]
@="ole.dll"
Value "2" specified:
[HKCR\CLSID\{Id}\InprocHandler32]
@="ole32.dll"
Value "3" specified:
[HKCR\CLSID\{Id}\InprocHandler]
@="ole.dll"
[HKCR\CLSID\{Id}\InprocHandler32]
@="ole32.dll"
Other value specified:
[HKCR\CLSID\{Id}\InprocHandler32]
@="Handler"
Specific Example (for other value)
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\InprocHandler32]
@="handler.dll"
Icon/IconIndex
This is not currently handled properly.
Insertable
In General
Value "no" specified:
[HKCR\CLSID\{Id}\NotInsertable]
Value "yes" specified:
[HKCR\CLSID\{Id}\Insertable]
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Insertable]
Programmable
In General
Value "yes" specified:
[HKCR\CLSID\{Id}\Programmable]
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Programmable]
RelativePath
Unsupported. Please contribute this back to WiX if you know.
SafeForInitializing
In General
Value "yes" specified:
[HKCR\CLSID\{Id}\Implemented Categories\{7DD95802-9882-11CF-9FA9-00AA006C42C4}]
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Implemented Categories\{7DD95802-9882-11CF-9FA9-00AA006C42C4}]
SafeForScripting
In General
Value "yes" specified:
[HKCR\CLSID\{Id}\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]
ThreadingModel
In General
[HKCR\CLSID\{Id}\Context]
ThreadingModel="ThreadingModel"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\LocalServer32]
ThreadingModel="Apartment"
TypeLibId (from parent TypeLib/@Id)
In General
[HKCR\CLSID\{Id}\TypeLib]
@="{TypeLibId}"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\TypeLib]
@="{11111111-89AB-1111-0123-111111111111}"
Version
In General
[HKCR\CLSID\{Id}\Version]
@="Version"
Specific Example
[HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Version]
@="1.0.0.0"
See Also
Wix Schema, AppId