I deployed a webpart by admin user in Visual Studio 2013 through in SharePoint 2013.

It's working fine. But when I deploy using another user which already have admin permission then it is showing below error.

Error occurred in deployment step 'Retract Solution': Object reference not set to an instance of an object.

  • I suppose there might be a value which is coming null in your code, so I suggest you try debugging your code step by step and check each variable values by placing watch to that variable. Still you are facing problem try elevating the privileges using this SPSecurity.RunWithElevatedPrivileges Method, MSDN article: msdn.microsoft.com/en-us/library/…
    – Pradip R.
    Jul 10, 2015 at 12:28
  • Cross verify once if the user is having admin rights on the web app you are trying to deploy. I have faced similar issue and that was because user is not having admin rights.
    – Amit
    Jul 10, 2015 at 12:33

3 Answers 3


It's most likely your SpSite or SpWeb object is null because of insufficient rights to the user. Can you make sure that the user have rights on the webapp you are deploying the solution too. A simple way to make sure that the user have sufficient rights is to create a new test solution and deploy, it will make things clear.


I had same problem and my solution was related with no space in disk for deployment. ps.: database disk.


I had same problem and i tried whatever was suggested in the blog. Like uninstall solution etc. Then I did a restart of system. And opened a new solution and tired to deploy.

But this time the error was very clear, I got a message it was due to increase in database size. After reducing deployment worked correctly.

  • So the solution is to increase the database size of which database?
    – Benny Skogberg
    Jun 8, 2016 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.