When working in TFS environment, sometimes project failed to deploy with error “Error occurred in deployment step ‘Recycle IIS Application Pool’: Object reference not set to an instance of an object“. The issue is the missing “Package” folder in SharePoint project.
Impact of missing “Package” folder
- If you have created the custom list using Visual Studio 2012 (or 2013) then the designer of list will not open and it will show the “Schema.xml” file instead.
- When deploying the project “Recycle IIS Application Pool’: Object reference not set to an instance of an object” error occurred.
- Check the files of the SharePoint project.
- There is one directory/folder “Package” which must be present. If this directory is missing in the project then open TFS explorer and go to the project directory. Take the latest version of “Package” from TFS.
- In Solution Explorer, select the project and click “Show all files” option. Include the “Package” folder in project. Take the latest version again of “Package”.
- Once added, build the project and deploy it. The project will be deployed.
Note : If you will get the same error again then close all instances of Visual Studio, do IISRESET and again reopen the Visual Studio and follow the above steps again.