Skip to content

IPreprocessHelper Interface

Interface provided to help preprocessor extensions.

MethodDescription
AddVariable(context, name, value)Add a variable.
AddVariable(context, name, value, showWarning)Add a variable.
EvaluateFunction(context, function)Evaluate a function.
EvaluateFunction(context, prefix, function, args)Evaluate a function.
GetVariableValue(context, variable, allowMissingPrefix)Get the value of a variable expression like var.name.
GetVariableValue(context, prefix, name)Get the value of a variable.
PreprocessPragma(context, pragmaName, args, parent)Evaluate a Pragma.
PreprocessString(context, value)Replaces parameters in the source text.
RemoveVariable(context, name)Remove a variable.
WixToolset.Extensibility.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8

Add a variable.

public void AddVariable(
WixToolset.Extensibility.Data.IPreprocessContext context,
string name,
string value
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
namestringThe variable name.
valuestringThe variable value.

AddVariable(context, name, value, showWarning) Method

Section titled “AddVariable(context, name, value, showWarning) Method”

Add a variable.

public void AddVariable(
WixToolset.Extensibility.Data.IPreprocessContext context,
string name,
string value,
bool showWarning
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
namestringThe variable name.
valuestringThe variable value.
showWarningboolSet to true to show variable overwrite warning.

EvaluateFunction(context, function) Method

Section titled “EvaluateFunction(context, function) Method”

Evaluate a function.

public string EvaluateFunction(
WixToolset.Extensibility.Data.IPreprocessContext context,
string function
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
functionstringThe function expression including the prefix and name.

string The function value.

EvaluateFunction(context, prefix, function, args) Method

Section titled “EvaluateFunction(context, prefix, function, args) Method”

Evaluate a function.

public string EvaluateFunction(
WixToolset.Extensibility.Data.IPreprocessContext context,
string prefix,
string function,
System.String[] args
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
prefixstringThe function prefix.
functionstringThe function name.
argsSystem.String[]The arguments for the function.

string The function value or null if the function is not defined.

GetVariableValue(context, variable, allowMissingPrefix) Method

Section titled “GetVariableValue(context, variable, allowMissingPrefix) Method”

Get the value of a variable expression like var.name.

public string GetVariableValue(
WixToolset.Extensibility.Data.IPreprocessContext context,
string variable,
bool allowMissingPrefix
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
variablestringThe variable expression including the optional prefix and name.
allowMissingPrefixbooltrue to allow the variable prefix to be missing.

string The variable value.

GetVariableValue(context, prefix, name) Method

Section titled “GetVariableValue(context, prefix, name) Method”

Get the value of a variable.

public string GetVariableValue(
WixToolset.Extensibility.Data.IPreprocessContext context,
string prefix,
string name
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
prefixstringThe variable prefix.
namestringThe variable name.

string The variable value or null if the variable is not set.

PreprocessPragma(context, pragmaName, args, parent) Method

Section titled “PreprocessPragma(context, pragmaName, args, parent) Method”

Evaluate a Pragma.

public void PreprocessPragma(
WixToolset.Extensibility.Data.IPreprocessContext context,
string pragmaName,
string args,
System.Xml.Linq.XContainer parent
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
pragmaNamestringThe pragma’s full name ({’<‘}prefix{’>’}.{’<‘}pragma{’>’}).
argsstringThe arguments to the pragma.
parentSystem.Xml.Linq.XContainerThe parent element of the pragma.

Replaces parameters in the source text.

public string PreprocessString(
WixToolset.Extensibility.Data.IPreprocessContext context,
string value
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
valuestringText that may contain parameters to replace.

string Text after parameters have been replaced.

Remove a variable.

public void RemoveVariable(
WixToolset.Extensibility.Data.IPreprocessContext context,
string name
)
ParameterTypeDescription
contextWixToolset.Extensibility.Data.IPreprocessContextThe preprocess context.
namestringThe variable name.