Implementing and launching custom actions to configure the environment based on the end-user configuration
Whoever is configuring your feature model can launch actions provided by you. For example, imagine that if someone selects the
input feature when configuring a feature model for games, then a new class or method is added to the current project in order to help the developer to handle joystick input.
How to implement a Confeaturator Action Provider?
1. Create a new class library project.
2. Add a reference to the UFPE.FeatureModelDSL.DslPackage.dll
assembly. This assembly can be found at
(change the visual studio version in this path if using VS 2008). If the
folder can't be found under the Extensions
folder, search for the
assembly once in the Extensions
3. Create a class that implements the UFPE.FeatureModelDSL.Confeaturator.IConfeaturatorActionProvider
interface. This interface defines a method called
, which receives the list of the features selected by the user in the Confeaturator tool window, as well as the
object used to manipulate the Visual Studio environment. Detailing the
features is out of the scope of this project - if you want more details, you can check the
Professional Visual Studio Extensibility
In the example below, if the Joystick
feature is selected, a new class file
is added to the solution.
How to consume a Confeaturator Action Provider?
1. Right-click the project which hosts the feature model files (.fm
, Existing Item
, then browse to the location of the .dll created in the steps above (How to implement a Confeaturator Action Provider?
2. In the Confeaturator
tool window, click in the Add / Remove Confeaturator Action Providers
button, click in
, expand the node of the aforementioned dll, and select the class that implements the
3. Back to the Confeaturator
tool window, click in the Launch Confeaturator Actions to configure the environment
button. This will invoke the implementation of the
method from the class you selected in step 2 just above.