"Error occurred in deployment step 'Activate Features': Key cannot be null. Parameter name: key" in Visual Studio 2010


In this article you will see how to resolve the error "Error occurred in deployment step 'Activate Features': Key cannot be null. Parameter name: key" in Visual Studio 2010.

Error

I have created a custom Content Type using Visual Studio 2010. The entire solution looks like the following:

Shr1.jpg

When I try to deploy the solution from Visual Studio 2010 by right-clicking on the solution and then click on Deploy, I was getting the error:

"Error occurred in deployment step 'Activate Features': Key cannot be null. Parameter name: key"

Reason

The reason is in the Content Type, the Elements.xml file <FieldRef> tag was closed as </FieldRef> which will be considered as an empty or null element.

Shr2.jpg

How to Resolve

In the Content Type Elements.xml file remove the </FieldRef> element and close the <FieldRef> element as shown below:

Shr3.jpg

Now I was able to deploy the content type successfully from Visual Studio 2010.

Summary

Thus in this article you have seen how to resolve the error "Error occurred in deployment step 'Activate Features': Key cannot be null. Parameter name: key" in Visual Studio 2010.

Up Next
    Ebook Download
    View all
    Learn
    View all