Automatically Generate Plugin Registration Attributes with Xrm Tools v1.3.0

In previous posts like Xrm Tools for Visual Studio , I explained the benefits of having a first-class development experience when building plugins using Xrm Tools. Starting from scratch with Xrm Tools is a joy—code completion, IntelliSense, and rich refactorings help you every step of the way.
But what if you already have existing plugins? Until now, enabling quick deploy and other features meant manually copying your plugin registration details into [Step] and [Image] attributes—tedious, and easy to get wrong.
💡 Light Bulb to the Rescue
As of Xrm Tools v1.3.0, you don’t have to write those attributes by hand anymore.
Let’s say you have a plugin like this:
[Plugin]
public partial class AccountWelcomePlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
...
}
}
Just make sure the cursor is at [Plugin]
, click on the light bulb that appears or press Ctrl + ., and choose the "Expand [Plugin] attribute and add [Step] and [Image] attributes".
Xrm Tools will expand the [Plugin]
attribute by adding missing properties if needed and will also generate all the missing [Step]
and [Image]
attributes for you—automatically, and without error.
Here’s what the result might look like:
[Plugin]
[Step("Create", "account", "name,description", Stages.PostOperation, ExecutionMode.Synchronous)]
[Step("Update", "account", "name,description", Stages.PostOperation, ExecutionMode.Synchronous)]
[Image(ImageTypes.PreImage, "name,description")]
public partial class AccountWelcomePlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
...
}
}
See It in Action
Watch the short screen capture below to see how easy it is to transform your existing plugin class with just a keystroke.
Screen capture showing how a light bulb action adds missing plugin registration attributes