This blog posting applies to Microsoft Office SharePoint Server 2007.
When using Visual Studio 2005 extensions for Windows SharePoint Services 3.0 to deploy a solution, you may see “Deploy started” then Deploy failed” in the status window and the error “‘Object reference not set to an instance of an object.” in the Error List window. Typical behavior is that the solution deployment works at first, possibly even for many deployments in a row, then at some point this error begins to appear and you can’t deploy the solution any more.
A workaround that fixes this problem for me is as follows:
1. Close Visual Studio 2005.
2. Uninstall (retract and remove) all deployed solutions. You only need to uninstall the ones you want to redeploy. The quickest way to uninstall is to open a command window to the directory of your Project\bin\debug folder and enter setup /uninstall. This runs faster than the solution management page in central administration (that one’s performed by a timer job, which has a “now” setting but still seems to take a minute to launch itself).
3. IISRESET. Oh, iisreset, what would we do without you?
4. Open you solution in VS2005 again and Deploy Solution from the Build menu, or you can Deploy <project> to get just the ones you uninstalled in step 2.
If this doesn’t work for you, a discussion at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1165399&SiteID=1 may give some additional clues. This theorizes the Object reference error stems from the deployment code trying to enumerate features that have a null definition property, and this prompted me to try the above steps. These have worked several times now for me, so I’m hoping this is the case.