CRM 2016 – Plugin Deployment Issue with CRM Development Toolkit ‘Cannot Insert the Duplicate Key’

I’ve recently faced an issue while deploying the Plugin using Developer Toolkit (using VS 2015). The issue was with ‘Deploy‘ step in the Development Toolkit.

 

CRM-VS

I’ll not be covering the information on how to configure Development Toolkit in Visual Studio and how to create Plugin Library or CRM Package. You can refer to the following blogs –

Now, let’s talk about the common issue that most of the CRM developers might have faced while deploying the plugin using toolkit.

Cannot Insert Duplicate Key

Steps, I followed to get rid of this issue –

  1. I clicked on build solution option in Visual Studio and there was no errors in the code and thought ‘YEAH‘ no errors but when I clicked on Deploy option there was one error “Cannot Insert Duplicate Key“.

I already edited the name of the class while registering the plugin and I knew that             there’s no plugin with the same class name.

Plugin Class

2. I then checked the Plugin Registration tool to find out if it may have registered the Assembly and the Plugin step but not updating the RegisterFile.crmregister in Visual Studio.

I was right the Assembly was registered but due to some reasons the Development Toolkit  hasn’t updated the IDs. So, I copied the following IDs from the Plugin Registration Assembly Properties into RegisterFile.crmregister file in Visual Studio.

PLugin Step

Assembly Tag ID in RegisterFile.crmregister is Assembly ID in Plugin Registration Tool under Properties tab.

Plugin Assembly.png

Plugin Description Tag ID in RegisterFile.crmregister is Plugin ID in Plugin Registration Tool under Properties tab.

PluginId

Step Customization Tag ID in RegisterFile.crmregister is Step ID in Plugin Registration Tool under Properties tab.

Setep ID

3. After copying the values, I deployed the solution and it got updated without any issues.

If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on LinkedIn, Twitter or Facebook. Thank you!


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.