Error occurred in deployment step ‘Add Solution’: Cannot insert duplicate key row in object

Error occurred in deployment step ‘Add Solution’: Cannot insert duplicate key row in object ‘dbo.Solutions’ with unique index ‘Solutions_BySiteAndSolutionId’.

The statement has been terminated.

When trying to deploy a sandboxed solution, I came across this error during deployment.

This occurred when I had to delete a site collection and then created a new one. After the site collection was created, I deployed my
solution and the error appeared.

“Error occurred in deployment step ‘Add Solution’: Cannot insert duplicate key row in object ‘dbo.Solutions’ with unique index ‘Solutions_BySiteAndSolutionId’. The duplicate key value is (d3cf46b0-031f-48d4-950f-0b8a8aa16a08, 4af7bfe5-667d-44f8-974c-306d47c617f7).

The statement has been terminated.”

Resolution

In your Visual Studio project, display the project properties window. From the toolbar, View > Properties window.

In Solution Explorer, click on the project node.

In the properties window, look for Site Url. Change the path of the Site URL and then save the solution.

Change the Site URL back to the original path and save again.

You should be able to successfully deploy your project.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: