Metalama 1.0 / / Metalama Documentation / Conceptual Documentation / Interacting with the IDE / Using Live Templates

Using Live Templates


This scenario is in early preview. It requires Visual Studio 2022 and does not seem to work in other IDEs.

Step 1. Add a project or package reference.

Add the aspect library to your project using a <ProjectReference> or a <PackageReference>. This step is required to have the aspect registered under the refactoring menu. You can remove the reference after the operation if needed.


If you only use live templates from this project, consider using the PrivateAssets="all" option, so the reference does not flow to the consumers of your project.

Step 2. Apply the live template

  1. Position the caret on the name of the declaration to which you want to apply the aspect.
  2. Click on the lightbulb or refactoring icon, and choose Apply live template_. Screenshot

  3. Select the aspect that you want to apply Screenshot