Partager via


Visual Studio Extensions (VSe) Deploy Failed (for SharePoint Solution)

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 https://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.

Good luck!

Comments

  • Anonymous
    July 27, 2007
    Body: They have been available for quite a while now: http://www.microsoft.com/downloads/details.aspx

  • Anonymous
    November 08, 2007
    I wrote this quick macro in Visual Studio to automate the above solution.  Sub UnDeployWSSProjandRestart()    Dim objSelectedProj As Project    Dim strProjectPath As String    Dim strAssembly As String    Dim strBuildDir As String    Dim strVSToolsDir As String = System.Environment.GetEnvironmentVariable("VS80COMNTOOLS")    'Get the selected project    For Each prjThis As Project In DTE.Solution.Projects      If DTE.ActiveDocument.ProjectItem.ContainingProject.Name = prjThis.Name Then _        objSelectedProj = prjThis    Next    'Make sure we've got a project to work with    If objSelectedProj Is Nothing Then      MsgBox("No project selected")      Exit Sub    End If    'Check for unsaved changes before we reload this project in a new instance    'This is necessary because we actally start VS before closing the current one to allow the macro to complete.    If (DTE.Solution.Saved = False) Then      If (MsgBox("You must save changes to continue.", MsgBoxStyle.YesNo) = MsgBoxResult.Yes) Then        DTE.ExecuteCommand("File.SaveAll")      Else        Exit Sub      End If    End If    'Get the assembly path details    strProjectPath = objSelectedProj.FullName    strAssembly = objSelectedProj.Properties.Item("OutputFileName").Value    strBuildDir = objSelectedProj.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value    If strBuildDir.IndexOf(":") = -1 Then      strBuildDir = objSelectedProj.FullName.Substring(0, objSelectedProj.FullName.LastIndexOf("")) & "" & strBuildDir    End If    'Web part projects using the VSeWSS have a SETUP.BAT file in the build directory    Shell("cmd /c echo | """ & strBuildDir & "setup.bat"" /uninstall", AppWinStyle.NormalFocus, True)    Shell("iisreset", AppWinStyle.NormalFocus)    'Now reload the project ;)    Dim strVSDevEnvPath As String    strVSDevEnvPath = strVSToolsDir.Substring(0, strVSToolsDir.Trim("").LastIndexOf("")) & "IDEdevenv.exe"    Shell("""" & strVSDevEnvPath & """ """ & strProjectPath & """", AppWinStyle.MaximizedFocus)    DTE.Quit()  End Sub